WSHttpBinding 和 Https 问题
我想同时使用会话和 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,因此日志记录不会有太大作用,但感谢您提及它。
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>
</binding>
</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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我没有尝试过,但 MSDN 说:
尝试文章中描述的自定义绑定。
编辑:
我检查了 Reflector 为什么它不能与
WsHttpBinding
一起使用。WsHttpBinding
在初始化安全性时包含此代码:这可能意味着
WsHttpBinding
允许通过不安全的通道或通过消息安全和安全对话保护的通道使用可靠的会话。I didn't try it but MSDN says:
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:It probably means that
WsHttpBinding
allows using reliable session over unsecured channel or over channel secured with message security and secure conversation.我建议您启用 WCF 日志记录 并查看生成的日志文件使用 SvcTraceViewer。这应该为您提供有关正在发生的事情的更多详细信息,并且通常可以帮助我追踪更困难的 WCF 问题。
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.