C# system.serviceModel/bindings/wsHttpBinding 上的绑定没有...错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9853483/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
The binding at system.serviceModel/bindings/wsHttpBinding does not have... error
提问by Bob
I am trying to include two endpoints in my WCF web based service - wsHttp and netTcp.
As shown in the Web.configbelow I have added them, but receive the following error when when I compile and click on Service.svc in my web browser:
我正在尝试在基于 WCF 的 Web 服务中包含两个端点 - wsHttp 和 netTcp。如下所示,Web.config我已经添加了它们,但是当我编译并在我的 Web 浏览器中单击 Service.svc 时收到以下错误:
Error page:
错误页面:
Server Error in '/MyService' Application. Configuration Error Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: The binding at system.serviceModel/bindings/wsHttpBinding does not have a configured binding named 'wsHttpBinding'. This is an invalid value for bindingConfiguration.
Source Error:
Line 16: </baseAddresses> Line 17: </host> Line 18: <endpoint address="http://localhost:8090/Services/MyService" Line 19: binding="wsHttpBinding" Line 20: bindingConfiguration="wsHttpBinding"
Source File: C:\MyService\web.config Line: 18
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
Web.config:
网页配置:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="false" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<protocolMapping>
<add scheme="http" binding="wsHttpBinding"/>
</protocolMapping>
<services>
<service
name="Microsoft.ServiceModel.Samples.MyService">
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:9001/"/>
</baseAddresses>
</host>
<endpoint address="http://localhost:8090/Services/MyService"
binding="wsHttpBinding"
bindingConfiguration="wsHttpBinding"
name="MyService_WsHttp"
contract="Microsoft.ServiceModel.Samples.IService" />
<endpoint address="net.tcp://localhost:9000/Services/MyService"
binding="netTcpBinding"
bindingConfiguration="tcpBinding"
name="MyService_Tcp"
contract="Microsoft.ServiceModel.Samples.IService" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- 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="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
采纳答案by Chris
take this out:
把这个拿出来:
bindingConfiguration="wsHttpBinding"
from here:
从这里:
address="http://localhost:8090/Services/MyService"
binding="wsHttpBinding"
bindingConfiguration="wsHttpBinding"
回答by Greko2015 GuFn
I don't thing that you have properly answer the question I'am sure he want to implement the
a binding configuration so instead of removing bindingConfiguration="wsHttpBinding, just make sure that the binding in your and point match the one in your configure file.
Hope this will work
我不认为您已经正确回答了这个问题,我确定他想要实现绑定配置,因此不要删除bindingConfiguration="wsHttpBinding,只需确保您和点中的绑定与配置文件中的绑定匹配。希望这会奏效
e.g:
例如:
<bindings>
<netTcpBinding>
<!--Configure the Service operation instance object timeout of an endpoint -->
<binding name="netTCP" receiveTimeout="00:00:10" />
</netTcpBinding>
</bindings>
<endpoint address="PerSessionService" binding="netTcpBinding" contract="InstanceContext_PerSessionService.IPerSessionService" bindingConfiguration="netTCP">

