我正在创建一个web服务,它将被世界上另一个地区的单个客户端使用。我对他们正在使用的技术没有任何知识或控制,但我被要求
“使用SSL加密传输期间的消息,并使用UsernameToken进行客户端身份验证”
我计划使用WCF4来创建服务,并且通常知道如何设置所有这些。然而,我很难找到绑定等的正确配置。Google给了我很多关于WSE 3.0的结果,但是我很确定(如果我错了,请纠正我),我不应该在WCF服务中使用WSE。
这的文章最初似乎建议我应该使用自定义绑定,但也说我应该“考虑使用具有适当安全设置的WCF系统定义的绑定,而不是创建自定义绑定”。然而,我看不到这应该是什么的任何例子。
如果有人能给我指明正确的方向,我将不胜感激。
tl;dr:支持SSL和UsernameToken的WCF4配置设置是什么?
发布于 2012-01-12 04:16:18
看一看WsHttpBinding。您可以使用TransportWithMessageCredential的安全模式使用SSL和UserName的消息凭据。如果您正在IIS中托管,请在那里设置SSL。
您可以按以下方式在配置中设置绑定。
<bindings>
<wsHttpBinding>
<binding name="secureBinding">
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" negotiateServiceCredential="false" establishSecurityContext="false" />
</security>
</binding>
</wsHttpBinding>
</bindings>然后,您可以按照以下方式使用此绑定配置
<services>
<service name="ServiceName">
<endpoint address="" binding="wsHttpBinding" contract="ContractType" bindingConfiguration="secureBinding" />
</service>
</services>这两个元素都是配置中system.serviceModel元素的子元素。
https://stackoverflow.com/questions/8827560
复制相似问题