你是对的,那里没有很多示例配置。您可以尝试以下配置。
NetTcpRelayBindingConstructor
NetTcpRelayBinding 构造函数(EndToEndSecurityMode,RelayClientAuthenticationType)
EndToEndSecurityMode 具有以下枚举。
Member name Description
None Security is disabled.
Transport Security is provided using a transport security, typically SSL.
Message Security is provided using SOAP message security.
TransportWithMessageCredential A secure transport (for example, HTTPS) provides integrity, confidentiality, and authentication while SOAP message security provides client authentication.
RelayClientAuthentication具有以下枚举。
Member name Description
RelayAccessToken If specified by a listener, the client is required to provide a security token.
None If specified by a listener, the client will not be required to provide a security token. This represents an opt-out mechanism with which listeners can waive the Access Control protection on the endpoint.
我见过的最接近的配置示例是 -
http://msdn.microsoft.com/en-us/library/windowsazure/microsoft.servicebus.nettcprelaybinding.aspx
<bindings>
<!-- Application Binding -->
<netTcpRelayBinding>
<binding name="customBinding">
<!-- Turn off client authentication -->
<security relayClientAuthenticationType="None" />
</netTcpRelayBinding>
</bindings>
这是您可以使用的示例:
<bindings>
<!-- Application Binding -->
<netTcpRelayBinding>
<binding name="customBinding">
<!-- Turn off client authentication -->
<security endToEndSecurityMode=”TransportWithMessageCredential” relayClientAuthenticationType="None" />
</netTcpRelayBinding>
</bindings>
但是,您必须确保在 machine.config 或应用程序配置文件中添加了服务总线绑定扩展元素才能使用它。如果没有,在任何情况下,Visual Studio 都会为您抛出错误。
从客户端到服务的端到端安全性不是特定于服务总线的,而只是标准 WCF。SB 唯一需要的是下面的 relayClientAuthenticationType。
<security mode="" relayClientAuthenticationType="RelayAccessToken">
nettcprelaybinding 的安全设置应该类似于 nettcpbinding。您可以使用 nettcpbinding 示例作为起点。