I am running the WCF service, which, among other things, is used as the back of the website. Since both the website and the WCF service are running on the same computer, and in the interest of performance, I configured it using netTcpBinding.
Now the fact is that, since they exist in one box, I really do not care about security at the transport level, nor about encryption at the message level; the only possible way to intercept messages is if someone gets to the web server itself, and if they do, I already have big problems.
So my question is: when the client and server are already in the trusted subsystem, what configuration can be used to ensure that netTcpBinding is as fast as possible?
Of course, the answer may be to use "none" security. But in my specific case, I still need to use UserName authentication for the user database. Can it be configured so that it still uses UserName authentication, but does not bother with certificates or ensures data security between endpoints? Or do I possibly need to implement custom behavior with a custom SOAP header to save the username / password, and then I can really set the security to "none"?
Server configuration
<netTcpBinding> <binding name="Net_Tcp_Binding"> <security mode="Message"> <message clientCredentialType="UserName" /> </security> </binding> </netTcpBinding>
It uses custom authentication UserName - basically, each call is authenticated and authorized against the user database. The service side also uses the certificate to negotiate with its customers, for example:
<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>
Client configuration
<netTcpBinding> <binding name="Net_Tcp_Endpoint"> <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" /> <security mode="Message"> <message clientCredentialType="UserName" /> </security> </binding> </netTcpBinding>
security wcf nettcpbinding
Gavin
source share