The binding at system.serviceModel/bindings/wsHttp

2019-07-06 10:36发布

问题:

I'm trying to create a second endpoint in my WCF web service. I can bring up the new endpoint's "Happy Page" by putting the domain URL in my browser, so I know that IIS can find the service, using my user account, properly.

However, if I try to run the web page that calls the service, I'm getting the error below

The binding at system.serviceModel/bindings/wsHttpBinding does not have a configured 
binding named 'WSHttpBinding_IMonetToDss'. This is an invalid value for 
bindingConfiguration. (D:\webcontent\Monet\web.config line 178).

Since this section of the config file is auto-generated by Visual Studio when I create the service reference the bindingConfiguration value is WSHttpBinding_IMonetToDss.. which it's saying it shouldn't be.

Below are both enpoints pulled from the web.config. The first endpoint /OKeeffe/OKeeffe.svc is working properly. The second endpoint for /OKeeffe/MonetToDss.svc is having the issue.

<client>
  <endpoint address="http://insidesoap.dev.symetra.com/Escher/EscherService.svc"
    binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IEscherService"
    contract="Escher.IEscherService" name="WSHttpBinding_IEscherService" />
  <endpoint address="http://insideapps.dev.symetra.com/OKeeffe/OKeeffe.svc"
    binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IAgentPayments"
    contract="AgentPayments.IAgentPayments" name="WSHttpBinding_IAgentPayments">
    <identity>
      <userPrincipalName value="s.AgentData.dev" />
    </identity>
  </endpoint>
  <endpoint address="http://insideapps.dev.symetra.com/OKeeffe/MonetToDss.svc"
    binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IMonetToDss"
    contract="MonetToDss.IMonetToDss" name="WSHttpBinding_IMonetToDss">
    <identity>
      <userPrincipalName value="s.AgentData.dev" />
    </identity>
  </endpoint>
</client>

EDIT

Here's the system.serviceModel section of the web service config file

  <system.serviceModel>
    <services>
        <service name="OKeeffeDataService.MonetToDss"
            behaviorConfiguration="MonetToDssBehaviors" >
        <endpoint address=""
            binding="wsHttpBinding"
            contract="OKeeffeDataService.IMonetToDss" />
        </service>
        <service name="OKeeffeDataService.AgentPayments"
               behaviorConfiguration="OKeeffeBehavior" >
        <endpoint address=""
                  binding="wsHttpBinding"
                  contract="OKeeffeDataService.IAgentPayments" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="OKeeffeBehavior">
          <!-- 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="true"/>
        </behavior>
        <behavior name="MonetToDssBehaviors" >
            <serviceMetadata httpGetEnabled="true" />
            <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors> 
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
  </system.serviceModel>

回答1:

are you sure you have defined a binding named "WSHttpBinding_IMonetToDss" in your config file? something like this...

<bindings>
<wsHttpBinding name="WSHttpBinding_IMonetToDss">
...
</wsHttpBinding>    
<bindings>