如何使用仅传输安全性的 wsHttpBidning 启用 WCF 会话

发布于 2024-08-29 02:31:00 字数 918 浏览 8 评论 0原文

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

我已经设置了

[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession)]

但是当我设置

SessionMode=SessionMode.Required

服务合同时它说

合约需要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>

请帮我解决这个问题

I have a WCF Service currently deployed with basicHttpBindings and SSL enabled. But now i need to enable wcf sessions(not asp sessions) so i moved service to wsHttpBidnings but sessions are not enabled

I have set

[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession)]

But when i set

SessionMode=SessionMode.Required

on service contract it says

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

following is the definition of WSHttpBinding

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

please help me with this

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

尹雨沫 2024-09-05 02:31:00

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

要在 wsHttpBinding 上启用会话,您需要可靠的消息传递,为此,您需要更改要启用的可靠会话的设置(类似于 的标记) - 因此你的新配置将如下所示:

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

If you want "sessions" with wsHttpBinding, you have to use either reliable messaging, or the security sessions.

To enable sessions on wsHttpBinding, you need reliable messaging, and for that, you need to change the setting for reliable session (the tag that looks like this <reliableSession/>) to be enabled - so your new config would look like this:

<wsHttpBinding>
    <binding name="wsHttpBinding">
      <readerQuotas maxStringContentLength="10240" />
      <reliableSession enabled="true" />
      <security mode="Transport">
        <transport clientCredentialType="None">
          <extendedProtectionPolicy policyEnforcement="Never" />
        </transport>
      </security>
    </binding>
  </wsHttpBinding>
烟织青萝梦 2024-09-05 02:31:00

好的 那么“需要 HTTPs 而不是 HTTP”错误将被修复。

well make <security mode="None"> then the "Https expected instead of HTTP error will be fixed.

笑咖 2024-09-05 02:31:00

转到您的 IIS 主机并右键单击您的应用程序,然后选择 MangeApplication 和高级设置,然后在启用的协议中添加“wsHttpBinding”。

go to your IIS host and Right Click on your Application and choose MangeApplication and Advanced Settings and in Enabled Protocols add "wsHttpBinding".

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文