如何使用 wsHttpBidning 启用 WCF Session with only Transport Security [英] how to enable WCF Session with wsHttpBidning with Transport only Security

查看:31
本文介绍了如何使用 wsHttpBidning 启用 WCF Session with only Transport Security的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

我已经设置了

[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession)]

但是当我设置

SessionMode=SessionMode.Required

服务合同上说

合约需要Session,但需要绑定'WSHttpBinding' 不支持或未正确配置以支持

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

以下是WSHttpBinding的定义

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>

请帮我解决这个问题

推荐答案

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

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

要在 wsHttpBinding 上启用会话,您需要可靠的消息传递,为此,您需要将可靠会话的设置(类似于 <reliableSession/> 的标记)更改为启用 - 所以你的新配置看起来像这样:

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>

这篇关于如何使用 wsHttpBidning 启用 WCF Session with only Transport Security的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆