0

We have a self-hosted WCF service based on a NetTCPBinding. Since a few weeks, a communicationexception randomly appears after 4000-5000 requests, and afterwards all requests are working again fine. Also, if I repeat the same failed request, the request works too. This misbehavior appears at one customer-installation, for 100 others the WCF-Service works quite fine with the same implementation and NetTCPBinding. From our side there was no update, the problems started over night. I activated Service trace viewer tool - however i could not find anything that gives rise to this problem. So i checked windows updates: I have seen that there was (amongst others) following Windows Update https://support.microsoft.com/de-at/help/4538158/kb4538158 which indicates that Microsoft "solved" an issue for WCFNetTCP binding. However, it seems that they have broken something here :-)

So I changed the NetTCPBinding to BasicHTTPBinding, and this exception does not appear anymore. However, we would like to use NetTCPBinding instead of BasicHTTPBinding... Has anybody else this problem?

1 Answers1

0

The communication error/timeout error typically is caused by that the client proxy is not properly closed. I suggest you put the client proxy/service channel in a Using statement.

using (ServiceReference1.ServiceClient client=new ServiceClient())
            {
                var result = client.Test();
                Console.WriteLine(result);
            }

Besides, please try to set up the below properties.

NetTcpBinding binding = new NetTcpBinding();
binding.MaxBufferSize = Int32.MaxValue;
binding.MaxBufferPoolSize = Int32.MaxValue;
binding.SendTimeout = new TimeSpan(0, 10, 0);
binding.ReceiveTimeout = new TimeSpan(0, 10, 0);
binding.OpenTimeout = new TimeSpan(0, 10, 0);

Feel free to let me know If the problem still exists.

Abraham Qian
  • 7,117
  • 1
  • 8
  • 22