WCF: Using multiple bindings for a single service.

Posted by Lijo on Stack Overflow See other posts from Stack Overflow or by Lijo
Published on 2010-05-22T15:22:59Z Indexed on 2010/05/22 15:30 UTC
Read the original article Hit count: 338

Filed under:

Hi,

I have a WCF service (in 3.0) which is running fine with wsHttpBinding. I want to add netTcpBinding binding also to the same service. But the challenge that I am facing is in adding behaviorConfiguration.

How should I modify the following code to enable the service for both the bindings? Please help…

  <service name="Lijo.Samples.WeatherService"
           behaviorConfiguration="WeatherServiceBehavior">

    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:8000/ServiceModelSamples/FreeServiceWorld"/>
        <add baseAddress="net.tcp://localhost:8052/ServiceModelSamples/FreeServiceWorld"/>
        <!-- added new baseaddress for TCP-->
      </baseAddresses>
    </host>

    <endpoint address=""
              binding="wsHttpBinding"
              contract="Lijo.Samples.IWeather" />

    <endpoint address=""
              binding="netTcpBinding"
              contract="Lijo.Samples.IWeather" />
    <!-- added new end point-->

    <endpoint address="mex"
              binding="mexHttpBinding"
              contract="IMetadataExchange" />

  </service>


</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="WeatherServiceBehavior">
      <serviceMetadata httpGetEnabled="true"/>
      <serviceDebug includeExceptionDetailInFaults="False"/>
    </behavior>
  </serviceBehaviors>
</behaviors>

Please see the following to see further details http://stackoverflow.com/questions/2887588/wcf-using-windows-service

Thanks

Lijo

© Stack Overflow or respective owner

Related posts about wcf-binding