【问题标题】:WSHttpBinding and Https problemWSHttpBinding 和 Https 问题
【发布时间】:2011-08-11 20:00:44
【问题描述】:

我想同时使用会话和 SSL,因此我设置了所有证书并确保在 WCF 服务上正确设置了所有内容。我已经尝试了一切,但我似乎无法让它发挥作用。它向我抛出了一个 InvalidoperationException,说 WsHttpBinding 无法创建安全会话,我应该使用 MessageSecurity 而不是 TransportSecurity。但我想使用 Https 而不是 Http,所以我想使用 TransportSecurity。谁能帮帮我。提前致谢。

WsHttpBinding 的 App.config:

   <wsHttpBinding>
    <binding name="WSHttpBinding">
     <reliableSession enabled="True" />
     <security mode="Transport">
      <transport clientCredentialType="None"/>
     </security>
    </binding>
   </wsHttpBinding>

编辑:我忘了提到当我尝试调用 ServiceHost.Open() 时会发生 InvalidOperationException 所以 Logging 不会有什么好处,但是谢谢你提到它。

【问题讨论】:

    标签: .net wcf app-config wcf-binding wcf-security


    【解决方案1】:

    我没试过但是MSDN says

    要通过 HTTPS 使用可靠会话,您必须创建一个使用可靠会话和 HTTPS 传输的自定义绑定。

    尝试文章中描述的自定义绑定。

    编辑:

    我检查了 Reflector 为什么它不适用于 WsHttpBindingWsHttpBinding 初始化安全时包含此代码:

    if (isReliableSession && !this.IsSecureConversationEnabled())
    {
        throw ...
    }
    

    这可能意味着WsHttpBinding 允许通过不安全的通道或通过消息安全和安全对话保护的通道使用可靠会话。

    【讨论】:

      【解决方案2】:

      我建议您启用WCF logging 并使用SvcTraceViewer 查看生成的日志文件。这应该为您提供更多关于正在发生的事情的详细信息,并且通常可以帮助我追踪更困难的 WCF 问题。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2016-09-23
        • 2020-10-02
        • 2017-04-17
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多