I've faced an strange problem in a very simple WCF service which was working correctly. The service is a web service with only one operation and response, with a BasicHttpBinding and all timeouts (receive, send, connect, open ...) set to 10 seconds. Suddenly one day started to be very slow (mostly by a network problem), but the timeouts seems to be not working.
<binding
openTimeout="00:00:10"
closeTimeout="00:00:10"
sendTimeout="00:00:10"
receiveTimeout="00:00:10" />
I have tried to get these timeouts to work, by connecting to the web service using a socket, and sending nothing and wait a number of seconds, but the connection only is broken after 120 seconds, so definitively the timeouts are not working.
//connect to the web service
sock.Connect(address, port);
//send something invalid
byte[] buffer = Encoding.Default.GetBytes("hello");
sock.Send(buffer);
//wait to be dropped or something
sock.Receive(buffer);
Is there any way to manually drop a connection from the service after a certain amount of time if no bytes are received?
Thanks!