Hi,
I have implemented a scenario which uses netTcpBinding and WsHttpBinding with Transport Security(https) as communication binding type in WCF. Then I compared the performance results. Interestingly, netTcpBinding was slower than wsHttpBinding. I have read a a lot of documents about binding performance and I know that the netTcpBinding provides the fastest communication because of binary encoding.
Can you explain what may cause this situation in my tests? Thanks.
Test environment: IIS 7
public static WSHttpBinding GetWSHttpForSSLBinding()
{
WSHttpBinding binding = new WSHttpBinding();
binding.TransactionFlow = true;
binding.MaxReceivedMessageSize = 2147483647;
binding.MessageEncoding = WSMessageEncoding.Text;
binding.Security.Mode = SecurityMode.Transport;
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
binding.ReaderQuotas.MaxStringContentLength = 2147483647;
binding.OpenTimeout = TimeSpan.MaxValue;
binding.CloseTimeout = TimeSpan.MaxValue;
binding.SendTimeout = TimeSpan.MaxValue;
binding.ReceiveTimeout = TimeSpan.MaxValue;
return binding;
}
public static NetTcpBinding GetTcpBinding()
{
NetTcpBinding binding = new NetTcpBinding();
binding.TransactionFlow = true;
binding.MaxReceivedMessageSize = 2147483647;
binding.PortSharingEnabled = true;
binding.Security.Mode = SecurityMode.Transport;
binding.Security.Transport.ClientCredentialType = TcpClientCredentialType.Windows;
binding.Security.Transport.ProtectionLevel = ProtectionLevel.EncryptAndSign;
binding.Security.Message.ClientCredentialType = MessageCredentialType.Windows;
binding.Security.Message.AlgorithmSuite = SecurityAlgorithmSuite.TripleDesSha256;
binding.ReaderQuotas.MaxStringContentLength = 2147483647;
binding.ReaderQuotas.MaxArrayLength = 2147483647;
binding.OpenTimeout = TimeSpan.MaxValue;
binding.CloseTimeout = TimeSpan.MaxValue;
binding.SendTimeout = TimeSpan.MaxValue;
binding.ReceiveTimeout = TimeSpan.MaxValue;
return binding;
}