c# - system.serviceModel/bindings/wsHttpBinding 处的绑定(bind)没有已配置的绑定(bind)

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

我正在尝试在我的 WCF Web 服务中创建第二个端点。我可以通过将域 URL 放入我的浏览器来调出新端点的“Happy Page”,因此我知道 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/

相关文章:

wcf - 用于 REST WCF 的 WSDL

asp.net - 在 WCF 服务中设置 HTTP 缓存控制 header

c# - 在 App.config 中设置 WCF ClientCredentials

c# - 将数据 View 排序为数据表

c# - 列表模型 Razor View

c# - 单一方法,可以返回数据行中某列的值,并自动处理该列可能为空的情况

javascript - 如何在 cshtml MVC3 Razor 页面上的 javascript 中嵌入 c# 代码

c# - unity 3D中的反转动画

asp.net-mvc - MVC3 自定义输出缓存

asp.net-mvc-3 - MVC3 MapRoute,带斜杠的参数