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

.net 如何使用仅传输安全性的wsHttpBidning启用WCF会话,.net,wcf,wcf-security,wshttpbinding,wcf-sessions,.net,Wcf,Wcf Security,Wshttpbinding,Wcf Sessions,我目前部署了一个WCF服务,其中启用了basicHttpBindings和SSL。但现在我需要启用wcf会话(而不是asp会话),所以我将服务移动到WSHttpBidings,但会话未启用 我已经准备好了 [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession)] 但当我开始 SessionMode=SessionMode.Required 服务合同上写着 契约需要会话,但具有约束力 “WSHttpBindi

我目前部署了一个WCF服务,其中启用了basicHttpBindings和SSL。但现在我需要启用wcf会话(而不是asp会话),所以我将服务移动到WSHttpBidings,但会话未启用

我已经准备好了

[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession)]
但当我开始

SessionMode=SessionMode.Required
服务合同上写着

契约需要会话,但具有约束力 “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>

请帮我解决这个问题

如果您想要使用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>


很好地制作
,然后“预期的Https而非HTTP错误将得到修复。

转到您的IIS主机,右键单击您的应用程序,选择MangeApplication and Advanced Settings,并在启用的协议中添加“wsHttpBinding”。

我以前尝试过此操作,但它会引发异常,显示”http scheme bla bla找不到基址,https scheme bla bla不支持reliableSessions“如果我想使用会话,但我不能按照您的建议执行,因为我的客户端是AJAX?因为AJAX不支持安全上下文。此答案不正确。Reliable sessions()不能与SSL()一起使用。”。当我尝试使用您的解决方案时,它会引发另一个关于找不到HTTPs基址的异常?什么是“安全会话”指的是什么?这是什么?