14

I am trying to include two endpoints in my WCF web based service - wsHttp and netTcp. As shown in the Web.config below I have added them, but receive the following error when when I compile and click on Service.svc in my web browser:

Error page:

Server Error in '/MyService' Application. Configuration Error Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: The binding at system.serviceModel/bindings/wsHttpBinding does not have a configured binding named 'wsHttpBinding'. This is an invalid value for bindingConfiguration.

Source Error:

Line 16: </baseAddresses> Line 17:         </host>  Line 18:  <endpoint address="http://localhost:8090/Services/MyService" Line 19:                   binding="wsHttpBinding" Line 20:                 bindingConfiguration="wsHttpBinding"


Source File: C:\MyService\web.config    Line: 18

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

Web.config:

<?xml version="1.0"?>
<configuration>
  <system.web>
    <compilation debug="false" targetFramework="4.0" />
  </system.web>
  <system.serviceModel>
    <protocolMapping>
      <add scheme="http" binding="wsHttpBinding"/>
    </protocolMapping>
    <services>
      <service
        name="Microsoft.ServiceModel.Samples.MyService">
        <host>
          <baseAddresses>
            <add baseAddress="net.tcp://localhost:9001/"/>
          </baseAddresses>
        </host>
        <endpoint address="http://localhost:8090/Services/MyService"
                  binding="wsHttpBinding"
                  bindingConfiguration="wsHttpBinding"
                  name="MyService_WsHttp"
                  contract="Microsoft.ServiceModel.Samples.IService" />
        <endpoint address="net.tcp://localhost:9000/Services/MyService"
                  binding="netTcpBinding"
                  bindingConfiguration="tcpBinding"
                  name="MyService_Tcp"
                  contract="Microsoft.ServiceModel.Samples.IService" />    
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>

</configuration>
Bob
  • 1,355
  • 5
  • 19
  • 38

2 Answers2

36

take this out:

          bindingConfiguration="wsHttpBinding"

from here:

address="http://localhost:8090/Services/MyService" 
                  binding="wsHttpBinding" 
                  bindingConfiguration="wsHttpBinding" 
Chris
  • 2,471
  • 25
  • 36
  • please mark as answer if its worked - reason for it is that if you're using 'out of the box' bindings (as you are...) then you've not made any configuration changes - which that attribute is meant to indicate. – Chris Mar 24 '12 at 16:59
  • When I use wsHttpBinding, it says contract must use DualHttpBinding ?! – Hari Jan 03 '14 at 09:06
  • @Hari are you developing a duplex service? – Chris Jan 03 '14 at 09:52
  • Sorry for the late reply . Yes Chris – Hari Jan 03 '14 at 10:39
  • you need to use wsDualHttpBinding (if I remember that right!) then. post up a Q and include your config. – Chris Jan 03 '14 at 10:47
1

I don't thing that you have properly answer the question I'am sure he want to implement the a binding configuration so instead of removing bindingConfiguration="wsHttpBinding, just make sure that the binding in your and point match the one in your configure file. Hope this will work

e.g:

<bindings>
      <netTcpBinding>
        <!--Configure the Service operation instance object timeout of an endpoint -->
        <binding name="netTCP" receiveTimeout="00:00:10" />
      </netTcpBinding>
    </bindings>

<endpoint address="PerSessionService" binding="netTcpBinding" contract="InstanceContext_PerSessionService.IPerSessionService" bindingConfiguration="netTCP">
Greko2015 GuFn
  • 512
  • 6
  • 13