基本 HTTP 绑定配置不正确 [英] Basic HTTP Binding isn't configured properly
本文介绍了基本 HTTP 绑定配置不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经使用 wsHTTPBinding 配置了 WCF 服务,但即使如此我还是收到错误
<块引用>Contract 需要 Session,但 Binding 'BasicHttpBinding' 不支持它或没有正确配置以支持它.
这里是服务契约定义
公共接口 IPrivateService
这里是服务实现定义
公共类私有服务实现 IPrivateService
这里是配置设置
<service behaviorConfiguration="behaviorAction" name="Viking.Service.PrivateService"><端点地址="RequiredService" binding="wsHttpBinding" bindingConfiguration="bindingAction" contract="Viking.Service.IPrivateService"><身份><dns value="localhost"/></身份></端点><endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/></服务></服务><绑定><wsHttpBinding><binding name="bindingAction" transactionFlow="false" sendTimeout="00:30:00" receiveTimeout="00:30:00"><reliableSession enabled="true"/></binding></wsHttpBinding></绑定>
非常感谢有关此问题的任何建议.
解决方案
如果您使用的是 wcf 4.0 则打开 web.config/app.config 并在
中添加以下标签标签.
<add scheme="http" binding="wsHttpBinding"/></protocolMapping>
i have configured a WCF service with wsHTTPBinding but even then i get the error
Contract requires Session, but Binding 'BasicHttpBinding' doesn't support it or isn't configured properly to support it.
here is the service contract definition
<ServiceContract(SessionMode:=SessionMode.Required)>
Public Interface IPrivateService
Here is the service implementation definition
<ServiceBehavior(InstanceContextMode:=InstanceContextMode.PerSession)>
Public Class PrivateService
Implements IPrivateService
Here is the config settings
<services>
<service behaviorConfiguration="behaviorAction" name="Viking.Service.PrivateService">
<endpoint address="RequiredService" binding="wsHttpBinding" bindingConfiguration="bindingAction" contract="Viking.Service.IPrivateService">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<bindings>
<wsHttpBinding>
<binding name="bindingAction" transactionFlow="false" sendTimeout="00:30:00" receiveTimeout="00:30:00">
<reliableSession enabled="true"/>
</binding>
</wsHttpBinding>
</bindings>
truly appreciate any advise on the issue.
解决方案
If you are using wcf 4.0 then open web.config/app.config and add following tag inside <system.serviceModel>
tag.
<protocolMapping>
<add scheme="http" binding="wsHttpBinding"/>
</protocolMapping>
这篇关于基本 HTTP 绑定配置不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文