Need Example of Config File With WebHttpBinding and BasicHttpBindingEndpoints

Discussion in 'ASP .Net Web Services' started by pbd22, Sep 17, 2009.

  1. pbd22

    pbd22 Guest

    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>
    pbd22, Sep 17, 2009
    #1
    1. Advertising

  2. pbd22

    pbd22 Guest

    Re: Need Example of Config File With WebHttpBinding andBasicHttpBinding Endpoints

    On Sep 16, 7:27 pm, pbd22 <> wrote:
    > 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.
    pbd22, Sep 17, 2009
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ABC
    Replies:
    1
    Views:
    796
    Richard Dudley
    Oct 24, 2005
  2. CSharpner
    Replies:
    0
    Views:
    1,019
    CSharpner
    Apr 9, 2007
  3. M Irfan
    Replies:
    2
    Views:
    3,920
    M Irfan
    Apr 18, 2007
  4. ABC
    Replies:
    1
    Views:
    364
    Patrick.O.Ige
    Oct 31, 2005
  5. kampy
    Replies:
    9
    Views:
    328
    Steven D'Aprano
    Oct 19, 2012
Loading...

Share This Page