Need Example of Config File With WebHttpBinding and BasicHttpBindingEndpoints


P

pbd22

Hi.

I am having a dandy time trying to figure out how to set up my config
file for both JSON and SOAP endpoints.

Some Background - Originally, I had an error that said something to
the effect that I cannot have two endpoints listening at the same
location so I went about creating unique addresses for my endpoints.
Since the service names are the same but the addresses are unique, I
took out the "base address" and defined the address attribute in the
endpoint definition.

I am now getting this error:

The HttpGetEnabled property of ServiceMetadataBehavior is set to
true and the HttpGetUrl property is a relative address, but there is
no http base address. Either supply an http base address or set
HttpGetUrl to an absolute address.

I feel like I am just digging myself into a deeper hole - could
somebody show me an example of a config file that illustrates both
webHttpBinding and basicHttpBinding for two different service
definitions (TradeService and AuthService below).

Thank you!

<system.serviceModel>
<client>
<endpoint address="http://localhost:8080/authservice/auth.svc"
behaviorConfiguration="WebHttpEPBehavior"
binding="webHttpBinding"
bindingConfiguration="jsonWeb"

contract="MyProject.WebAPI.Authentication.IJSONAuthService"
name="MyJSONAuthEP" />
<endpoint address="http://localhost:80/authservice/auth.svc"
behaviorConfiguration="BasicHttpEPBehavior"
binding="basicHttpBinding"
bindingConfiguration="soapWeb"

contract="MyProject.WebAPI.Authentication.ISOAPAuthService"
name="MySOAPAuthEP" />
<endpoint address="http://localhost:8081/tradeservice/trade.svc"
behaviorConfiguration="WebHttpEPBehavior"
binding="webHttpBinding"
bindingConfiguration="jsonWeb"
contract="MyProject.WebAPI.Trade.IJSONTradeService"
name="MyJSONTradeEP" />
<endpoint address="http://localhost:81/tradeservice/trade.svc"
behaviorConfiguration="BasicHttpEPBehavior"
binding="basicHttpBinding"
bindingConfiguration="soapWeb"
contract="MyProject.WebAPI.Trade.ISOAPTradeService"
name="MySOAPTradeEP" />
</client>
<bindings>
<webHttpBinding>
<binding name="jsonWeb" maxBufferSize="1500000"
maxBufferPoolSize="1500000"
maxReceivedMessageSize="1500000">
<readerQuotas maxDepth="32" maxStringContentLength="656000"
maxArrayLength="656000"
maxBytesPerRead="656000" maxNameTableCharCount="656000" />
</binding>
</webHttpBinding>
<basicHttpBinding>
<binding name="soapWeb">
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="Default">
<serviceMetadata httpGetEnabled="True" />
<serviceDebug includeExceptionDetailInFaults="True" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="WebHttpEPBehavior">
<webHttp />
</behavior>
<behavior name="BasicHttpEPBehavior">
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<services>
<service behaviorConfiguration="Default"
name="MyProject.WebAPI.Trade.TradeService">
<endpoint address="http://localhost:8081/tradeservice"
behaviorConfiguration="WebHttpEPBehavior"
binding="webHttpBinding"
bindingConfiguration="jsonWeb"
contract="MyProject.WebAPI.Trade.IJSONTradeService"
name="MyTradeEP" />
<endpoint address="http://localhost:81/tradeservice"
behaviorConfiguration="BasicHttpEPBehavior"
binding="basicHttpBinding"
bindingConfiguration="soapWeb"
contract="MyProject.WebAPI.Trade.ISOAPTradeService"
name="MySOAPTradeEP" />
</service>
<service behaviorConfiguration="Default"
name="MyProject.WebAPI.Authentication.AuthService">
<endpoint address="http://localhost:8080/authservice"
behaviorConfiguration="WebHttpEPBehavior"
binding="webHttpBinding"
bindingConfiguration="jsonWeb"

contract="MyProject.WebAPI.Authentication.IJSONAuthService"
name="MyJSONAuthEP" />
<endpoint address="http://localhost:80/authservice"
behaviorConfiguration="BasicHttpEPBehavior"
binding="basicHttpBinding"
bindingConfiguration="soapWeb"

contract="MyProject.WebAPI.Authentication.ISOAPAuthService"
name="MySOAPAuthEP" />
</service>
</services>
</system.serviceModel>
 
Ad

Advertisements

P

pbd22

Hi.

I am having a dandy time trying to figure out how to set up my config
file for both JSON and SOAP endpoints.

Some Background - Originally, I had an error that said something to
the effect that I cannot have two endpoints listening at the same
location so I went about creating unique addresses for my endpoints.
Since the service names are the same but the addresses are unique, I
took out the "base address" and defined the address attribute in the
endpoint definition.

I am now getting this error:

    The HttpGetEnabled property of ServiceMetadataBehavior is set to
true and the HttpGetUrl property is a relative address, but there is
no http base address. Either supply an http base address or set
HttpGetUrl to an absolute address.

I feel like I am just digging myself into a deeper hole - could
somebody show me an example of a config file that illustrates both
webHttpBinding and basicHttpBinding for two different service
definitions (TradeService and AuthService below).

Thank you!

<system.serviceModel>
    <client>
      <endpoint address="http://localhost:8080/authservice/auth.svc"
                behaviorConfiguration="WebHttpEPBehavior"
                binding="webHttpBinding"
                bindingConfiguration="jsonWeb"

contract="MyProject.WebAPI.Authentication.IJSONAuthService"
                name="MyJSONAuthEP" />
      <endpoint address="http://localhost:80/authservice/auth.svc"
                behaviorConfiguration="BasicHttpEPBehavior"
                binding="basicHttpBinding"
                bindingConfiguration="soapWeb"

contract="MyProject.WebAPI.Authentication.ISOAPAuthService"
                name="MySOAPAuthEP" />
      <endpoint address="http://localhost:8081/tradeservice/trade..svc"
                behaviorConfiguration="WebHttpEPBehavior"
                binding="webHttpBinding"
                bindingConfiguration="jsonWeb"
                contract="MyProject.WebAPI.Trade.IJSONTradeService"
                name="MyJSONTradeEP" />
      <endpoint address="http://localhost:81/tradeservice/trade.svc"
                behaviorConfiguration="BasicHttpEPBehavior"
                binding="basicHttpBinding"
                bindingConfiguration="soapWeb"
                contract="MyProject.WebAPI.Trade.ISOAPTradeService"
                name="MySOAPTradeEP" />
    </client>
    <bindings>
      <webHttpBinding>
        <binding name="jsonWeb" maxBufferSize="1500000"
maxBufferPoolSize="1500000"
          maxReceivedMessageSize="1500000">
          <readerQuotas maxDepth="32" maxStringContentLength="656000"
maxArrayLength="656000"
            maxBytesPerRead="656000" maxNameTableCharCount="656000" />
        </binding>
      </webHttpBinding>
      <basicHttpBinding>
        <binding name="soapWeb">
        </binding>
      </basicHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
          <behavior name="Default">
              <serviceMetadata httpGetEnabled="True" />
              <serviceDebug includeExceptionDetailInFaults="True" />
          </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="WebHttpEPBehavior">
          <webHttp />
        </behavior>
        <behavior name="BasicHttpEPBehavior">
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
    <services>
    <service behaviorConfiguration="Default"
name="MyProject.WebAPI.Trade.TradeService">
      <endpoint address="http://localhost:8081/tradeservice"
        behaviorConfiguration="WebHttpEPBehavior"
        binding="webHttpBinding"
        bindingConfiguration="jsonWeb"
        contract="MyProject.WebAPI.Trade.IJSONTradeService"
        name="MyTradeEP" />
      <endpoint address="http://localhost:81/tradeservice"
                behaviorConfiguration="BasicHttpEPBehavior"
                binding="basicHttpBinding"
                bindingConfiguration="soapWeb"
                contract="MyProject.WebAPI.Trade.ISOAPTradeService"
                name="MySOAPTradeEP" />
      </service>
      <service behaviorConfiguration="Default"
name="MyProject.WebAPI.Authentication.AuthService">
      <endpoint address="http://localhost:8080/authservice"
                behaviorConfiguration="WebHttpEPBehavior"
                binding="webHttpBinding"
                bindingConfiguration="jsonWeb"

contract="MyProject.WebAPI.Authentication.IJSONAuthService"
                name="MyJSONAuthEP" />
      <endpoint address="http://localhost:80/authservice"
                behaviorConfiguration="BasicHttpEPBehavior"
                binding="basicHttpBinding"
                bindingConfiguration="soapWeb"

contract="MyProject.WebAPI.Authentication.ISOAPAuthService"
                name="MySOAPAuthEP" />
      </service>
    </services>
  </system.serviceModel>

OR... can somebody point out where I am going wrong in my current
config file?

Thanks again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top