开发者

WSHttpBinding and Https problem

开发者 https://www.devze.com 2023-03-27 18:09 出处:网络
I want to use Sessions and SSL at the same time so I set up all the certificates and made sure everything was set up properly on the WCF service. I\'ve tried about everything but I cant seem to get th

I want to use Sessions and SSL at the same time so I set up all the certificates and made sure everything was set up properly on the WCF service. I've tried about everything but I cant seem to get this to work. It throws me a InvalidoperationException saying that the WsHttpBinding can't create secure sessions and that I should use MessageSecurity instead of TransportSecurity.But I want to use Https and not Http so I want to use TransportSecurity. Could Anyone please help me out. Thanks in advance.

App.config for WsHttpBinding:

   <wsHttpBinding>
    <binding name="WSHttpBinding">
     <reliableSession enabled="True" />
     <security mode="Transport">
      <transport clientCredentialType="None"/>
     </security>
    </bindi开发者_如何学运维ng>
   </wsHttpBinding>

Edit: I forgot to mention that the InvalidOperationException Occurs when I try to call ServiceHost.Open() So the Logging will not do much good, but thank you for mentioning it.


I didn't try it but MSDN says:

To use a reliable session over HTTPS, you must create a custom binding that uses a reliable session and the HTTPS transport.

Try the custom binding described in the article.

Edit:

I checked with Reflector why it doesn't work with WsHttpBinding. WsHttpBinding contains this code when initializing security:

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

It probably means that WsHttpBinding allows using reliable session over unsecured channel or over channel secured with message security and secure conversation.


I would suggest you enable WCF logging and take a look at the resulting logfile using SvcTraceViewer. This should provide you with a lot more detail about what's going on and usually helps me in tracking down the more difficult WCF issues.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号