gpt4 book ai didi

.net - 如何使用 wsHttpBidning 启用 WCF Session with only Transport Security

转载 作者:行者123 更新时间:2023-12-04 15:16:09 25 4
gpt4 key购买 nike

我目前部署了一个 WCF 服务,启用了 basicHttpBindings 和 SSL。但是现在我需要启用 wcf session (不是 asp session ),所以我将服务移至 wsHttpBidnings 但未启用 session

我已经设定

[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession)]

但是当我设置
SessionMode=SessionMode.Required

在服务契约(Contract)上说

Contract requires Session, but Binding 'WSHttpBinding' doesn't support it or isn't configured properly to support it.



以下是 WSHttpBinding 的定义
<wsHttpBinding>
<binding name="wsHttpBinding">
<readerQuotas maxStringContentLength="10240" />
<reliableSession enabled="false" />
<security mode="Transport">
<transport clientCredentialType="None">
<extendedProtectionPolicy policyEnforcement="Never" />
</transport>
</security>
</binding>
</wsHttpBinding>

请在这件事上给予我帮助

最佳答案

如果您想使用 wsHttpBinding 进行“ session ”,则必须使用可靠消息传递或安全 session 。

要在 wsHttpBinding 上启用 session ,您需要可靠的消息传递,为此,您需要更改要启用的可靠 session 的设置(看起来像 <reliableSession/> 的标签) - 因此您的新配置将如下所示:

<wsHttpBinding>
<binding name="wsHttpBinding">
<readerQuotas maxStringContentLength="10240" />
<reliableSession enabled="true" />
<security mode="Transport">
<transport clientCredentialType="None">
<extendedProtectionPolicy policyEnforcement="Never" />
</transport>
</security>
</binding>
</wsHttpBinding>

关于.net - 如何使用 wsHttpBidning 启用 WCF Session with only Transport Security,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2650738/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com