我正在尝试在WCF Web服务中创建第二个终结点。我可以通过将域URL放在浏览器中来显示新端点的“快乐页面”,因此我知道IIS可以使用我的用户帐户正确找到该服务。

但是,如果我尝试运行调用该服务的网页,则会收到以下错误

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).

由于配置文件的这一部分是由Visual Studio在创建服务引用时自动生成的,因此bindingConfiguration的值为WSHttpBinding_IMonetToDss ..这就是说不应该的。

以下是从web.config中提取的所有内容。第一个端点/OKeeffe/OKeeffe.svc正常工作。 /OKeeffe/MonetToDss.svc的第二个端点有问题。
<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>

编辑

这是Web服务配置文件的system.serviceModel部分
  <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>

最佳答案

您确定在配置文件中定义了一个名为“WSHttpBinding_IMonetToDss”的绑定(bind)吗?像这样的东西

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

关于c# - system.serviceModel/bindings/wsHttpBinding处的绑定(bind)没有配置的绑定(bind),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/22868531/

10-11 20:06