当我在使用的ServiceContract然后SessionMode = SessionMode.Required
我得到这个错误合同需要会议,但绑定“basicHttpBinding的”不支持或没有正确配置来支持它
合同需要会议,但绑定'BasicHttpBinding'不支持 或未正确配置以支持它。
有人告诉我一个解决方案吗?
当我在使用的ServiceContract然后SessionMode = SessionMode.Required
我得到这个错误合同需要会议,但绑定“basicHttpBinding的”不支持或没有正确配置来支持它
合同需要会议,但绑定'BasicHttpBinding'不支持 或未正确配置以支持它。
有人告诉我一个解决方案吗?
因为它已上市here,请选择wsHttpBinding
或NetTcpBinding.WSHttpBinding
绑定。
此错误消息很少清楚。这里的答案是这样的,basichttpbinding不支持会话。所以如果你想使用它,你必须使用下面的属性。 [ServiceContract(SessionMode = SessionMode.Allowed)]
这意味着,如果您尝试配置多个绑定,如basichttp,wshttp,net.tcp,则WCF将自动启用除basichttp绑定之外的会话。所以如果你把SessionMode.Required而不是Allowed,那么你不得不使用basichttpbinding。
也就是说,通常解决这一问题就需要这样的事:
<system.serviceModel>
<protocolMapping>
<add scheme="http" binding="wsHttpBinding" bindingConfiguration="wsHttpBindingConfiguration" />
</protocolMapping>
<bindings>
<wsHttpBinding>
<binding name="wsHttpBindingConfiguration" transactionFlow="true" />
</wsHttpBinding>
.......
我使用的解决方案,但问题并没有消失,然后我发现一件事情要做[这里](HTTP: //stackoverflow.com/questions/4930403/basic-http-binding-isnt-configured-properly)所以不要忘了将这个添加到你的配置中...... –
Mochi
2014-05-27 14:27:02