我正在运行一个WCF服务,除此之外,它被用作网站的后端。由于Web站点和WCF服务都在同一台机器上运行,为了提高性能,我使用netTcpBinding进行设置。netTcpBinding最快可能的安全配置是什么?
现在的事情是,因为它们存在于同一个盒子里,我真的不关心传输级别的安全或消息级加密;消息被拦截的唯一可能方式是如果有人进入Web服务器本身,并且如果他们这样做,我已经遇到了更大的问题。
所以我的问题是:当客户端和服务器已经在受信任的子系统上时,可以使用什么配置来确保netTcpBinding尽可能快?
当然,答案可能是使用“none”的安全性。但在我的特殊情况下,我仍然需要对自定义数据库使用UserName身份验证。可以配置它,以便它仍然使用UserName身份验证,但不打扰证书或保护端点之间的数据?或者,我可能需要实现一个自定义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>