【问题标题】:The binding at system.serviceModel/bindings/wsHttpBinding does not have a configured bindingsystem.serviceModel/bindings/wsHttpBinding 处的绑定没有配置的绑定
【发布时间】:2014-04-04 16:47:46
【问题描述】:

我正在尝试在我的 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>

【问题讨论】:

    标签: c# asp.net-mvc-3 wcf wshttpbinding wcf-wshttpbinding


    【解决方案1】:

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

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

    【讨论】:

    • 你的意思是在网站还是网络服务本身?刚刚发布了该服务的一部分配置。
    • @NealR - 它需要在配置文件的&lt;system.serviceModel&gt; 部分中定义,并带有引用它的端点。
    • 我相信这就是我所做的:&lt;service name="OKeeffeDataService.MonetToDss" behaviorConfiguration="MonetToDssBehaviors" &gt; &lt;endpoint address="" binding="wsHttpBinding" contract="OKeeffeDataService.IMonetToDss" /&gt;
    • 我在问...你的配置中有任何“”部分吗?它应该与 一起存在。它不在您的配置中。所以添加它。请参考msdn.microsoft.com/en-us/library/ms733099(v=vs.110).aspx。检查最后一个例子
    • 非常感谢!这是解决方案,我没有将此部分复制到我的环境配置中进行部署
    猜你喜欢
    • 1970-01-01
    • 2013-08-16
    • 2013-09-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-04
    相关资源
    最近更新 更多