How can netTcpBinding be slower than wsHttpBinding?

I implemented a script that uses netTcpBinding and WsHttpBinding with transport security (https) as the type of binding binding in WCF. Then I compared the results. Interestingly, netTcpBinding was slower than wsHttpBinding. I have read many documents on binding performance, and I know that netTcpBinding provides the fastest connection due to binary coding.

Can you explain what might cause this situation in my tests? Thank.

Test Terms: 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;
}
+3
source share
2 answers

net.tcp , ws http . Alse - . - .

+3

. , .

NetTcp , , BinaryEncoding vs TextEncoding wshttp.

- NetTcp windows auth AD wshttp, SSL auth.

+2

Source: https://habr.com/ru/post/1766174/


All Articles