现在的问题是,因为它们存在于同一个盒子上,我真的不关心传输级安全性或消息级加密;截获消息的唯一可能方式是,如果有人进入web服务器本身,如果他们这样做,我已经遇到了更大的问题。
所以我的问题是:当客户机和服务器已经在一个受信任的子系统上时,可以使用什么配置来确保netTcpBinding尽可能快?
当然,答案可能是使用“无”的安全性。但在我的特殊情况下,我仍然需要对自定义数据库使用用户名身份验证。是否可以对其进行配置,使其仍然使用用户名身份验证,但不必担心证书或保护端点之间的数据?或者我是否需要使用自定义SOAP头实现自定义行为来存储用户名/密码,然后我真的可以将安全性设置为“无”?
<netTcpBinding>
<binding name="Net_Tcp_Binding">
<security mode="Message">
<message clientCredentialType="UserName" />
</security>
</binding>
</netTcpBinding>
它使用自定义用户名身份验证-基本上每个调用都进行身份验证&针对自定义数据库进行授权。服务方还使用证书与其客户进行协商,例如:
<serviceBehaviors>
<behavior name="MyBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceAuthorization principalPermissionMode="Custom">
<authorizationPolicies>
<add policyType="MyAssembly.CustomAuthorizationPolicy,MyAssembly" />
</authorizationPolicies>
</serviceAuthorization>
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="MyAssembly.CustomCredentialValidator,MyAssembly" />
<serviceCertificate x509FindType="FindBySubjectName" findValue="CN=servercert" storeLocation="LocalMachine" storeName="My" />
</serviceCredentials>
</behavior>
</serviceBehaviors>
客户配置
<netTcpBinding>
<binding name="Net_Tcp_Endpoint">
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
<security mode="Message">
<message clientCredentialType="UserName" />
</security>
</binding>
</netTcpBinding>