Mub*_*har 6 .net wcf wshttpbinding wcf-security wcf-sessions
我目前使用basicHttpBindings和SSL启用了WCF服务.但现在我需要启用wcf会话(而不是asp会话)所以我将服务转移到wsHttpBidnings但是会话未启用
我已经设定
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession)]
Run Code Online (Sandbox Code Playgroud)
但是当我设定的时候
SessionMode=SessionMode.Required
Run Code Online (Sandbox Code Playgroud)
在服务合同上,它说
合同需要Session,但Binding'WSHttpBinding'不支持它,或者没有正确配置以支持它.
以下是WSHttpBinding的定义
<wsHttpBinding>
<binding name="wsHttpBinding">
<readerQuotas maxStringContentLength="10240" />
<reliableSession enabled="false" />
<security mode="Transport">
<transport clientCredentialType="None">
<extendedProtectionPolicy policyEnforcement="Never" />
</transport>
</security>
</binding>
</wsHttpBinding>
Run Code Online (Sandbox Code Playgroud)
请在这件事上给予我帮助
如果您想要与wsHttpBinding"会话",则必须使用可靠的消息传递或安全会话.
要在wsHttpBinding上启用会话,您需要可靠的消息传递,为此,您需要更改可靠会话的设置(看起来像这样的标记<reliableSession/>) - 因此您的新配置将如下所示:
<wsHttpBinding>
<binding name="wsHttpBinding">
<readerQuotas maxStringContentLength="10240" />
<reliableSession enabled="true" />
<security mode="Transport">
<transport clientCredentialType="None">
<extendedProtectionPolicy policyEnforcement="Never" />
</transport>
</security>
</binding>
</wsHttpBinding>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
16337 次 |
| 最近记录: |