我正在尝试将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 /。
答案 0 :(得分:1)
客户端配置的以下部分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>
注意“绑定”部分