【问题标题】:Binding wcf with asp.net将 wcf 与 asp.net 绑定
【发布时间】:2012-06-26 15:41:13
【问题描述】:

我正在尝试将一个 asp.net 页面绑定到另一个网站托管的 wcf 服务,

客户端的 web.config 文件包含以下代码:

<endpoint address="http://localhost:1670/webhost/CustomersService.svc" binding="wsHttpBinding" bindingConfiguration="wsHttpBinding_ICustomersService" contract="CustomersService.ICustomersService" name="BasicHttpBinding_ICustomersService"/>
</client>

服务的 web.config 文件有代码:

<endpoint address="" binding="wsHttpBinding" contract="CustomerServiceLibrary1.ICustomersService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>

错误是:

错误 1 ​​Reference.svcmap:system.serviceModel/bindings/wsHttpBinding 处的绑定没有名为“wsHttpBinding_ICustomersService”的已配置绑定。这是 bindingConfiguration 的无效值。 (C:\Users\Lara\Documents\Visual Studio 2010\Projects\CustomerServiceDemo\WebClient\web.config 第 25 行)App_WebReferences/CustomersService/。

【问题讨论】:

    标签: asp.net wcf wcf-binding


    【解决方案1】:

    我遇到了同样的异常
    “system.serviceModel/bindings/basicHttpBinding 处的绑定没有配置的名为‘BasicHttpBinding_ITestService’的绑定。这是 bindingConfiguration 的无效值。”
    我的问题已解决,当我在代码中指定并添加在客户端具有 basicHttpBinding 的端点名称时

    TestServiceClient obj = new TestServiceClient("BasicHttpBinding_ITestService");
    

    【讨论】:

      【解决方案2】:

      您的客户端配置 bindingConfiguration="wsHttpBinding_ICustomersService" 的以下部分

      告诉它应该使用名称为“wsHttpBinding_ICustomersService”的绑定配置您的客户端 web.config 中是否有使用该名称的绑定配置?

      以下文章解释了 WCF 和绑定 http://msdn.microsoft.com/en-us/magazine/cc163394.aspx

      但这部分应该是你要找的

      <configuration>
        <system.serviceModel>
          <services>
            <service name=”ChatService”>
              <endpoint address=”http://localhost:8080/chat” 
                binding=”basicHttpBinding” 
                bindingConfiguration=”basicConfig” 
                contract=”ChatLibrary.IChat” />
              ...
            </service>
          </services>
          <bindings>
            <basicHttpBinding>
              <binding name=”basicConfig” messageEncoding=”Mtom”>
                <security mode=”Transport”/>
              </binding>
            </basicHttpBinding>
            ...
          </bindings>
        </system.serviceModel>
      </configuration>
      

      注意“绑定”部分

      【讨论】:

        猜你喜欢
        • 2018-07-04
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多