将wcf与asp.net绑定
我正在尝试将asp.net页面绑定到另一个网站托管的wcf服务 客户端的web.config文件包含以下代码:将wcf与asp.net绑定,asp.net,wcf,wcf-binding,Asp.net,Wcf,Wcf Binding,我正在尝试将asp.net页面绑定到另一个网站托管的wcf服务 客户端的web.config文件包含以下代码: 服务的web.config文件包含以下代码: <endpoint address="" binding="wsHttpBinding" contract="CustomerServiceLibrary1.ICustomersService"> <identity> <dns value="localhost" /> </identity&
服务的web.config文件包含以下代码:
<endpoint address="" binding="wsHttpBinding" contract="CustomerServiceLibrary1.ICustomersService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
错误是:
错误1 Reference.svcmap:system.serviceModel/bindings/wsHttpBinding处的绑定未配置名为“wsHttpBinding_iccustomersservice”的绑定。这是bindingConfiguration的无效值。(C:\Users\Lara\Documents\Visual Studio 2010\Projects\CustomerServiceDemo\WebClient\web.config第25行)App\u WebReferences/CustomerService/ 客户端配置的以下部分bindingConfiguration=“wsHttpBinding\u iccustomersservice” 告诉它应该使用名为“wsHttpBinding_icCustomerService”的绑定配置。您的客户端web.config中是否有同名的绑定配置 下面的文章解释了WCF和绑定 但这部分应该是你想要的
<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>
...
...
请注意客户端配置bindingConfiguration=“wsHttpBinding\u ICCustomerService”的以下部分的“绑定”部分 告诉它应该使用名为“wsHttpBinding_icCustomerService”的绑定配置。您的客户端web.config中是否有同名的绑定配置 下面的文章解释了WCF和绑定 但这部分应该是你想要的
<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>
...
...
注意“绑定”部分我得到了相同的异常
“system.serviceModel/bindings/basicHttpBinding处的绑定没有名为'basicHttpBinding_ITestService'的已配置绑定。这是bindingConfiguration的无效值。”
当我在代码中指定并添加客户端具有basicHttpBinding的端点的名称时,我的问题得到了解决
TestServiceClient obj = new TestServiceClient("BasicHttpBinding_ITestService");
我也遇到了同样的例外情况
“system.serviceModel/bindings/basicHttpBinding处的绑定没有名为'basicHttpBinding_ITestService'的已配置绑定。这是bindingConfiguration的无效值。”
当我在代码中指定并添加客户端具有basicHttpBinding的端点的名称时,我的问题得到了解决
TestServiceClient obj = new TestServiceClient("BasicHttpBinding_ITestService");