Wcf reading stream fails when network connection is lost
-
I am sending large file stream from client to wcf service using tranfer mode as stream with basichttpbinding. During streaming, if the client loses the network connection , client gets socket timeout exception. But WCF service continues to wait for the stream until the timeout specified. When the network resumes and next call is made to wcf service from the client, we observe that wcf has not released the previous process and still waiting for the previous response. Timeouts specified in client and wcf service is as below opentimeout, closetimeout, sendtimeout, receivetimeout is set to 12 hours. The file is not released upto 12 hours. Is there any method where we while during reading the stream from wcf, if client is disconnected, terminate the process. I have been struggling from the past 2 days. Please help
-
I am sending large file stream from client to wcf service using tranfer mode as stream with basichttpbinding. During streaming, if the client loses the network connection , client gets socket timeout exception. But WCF service continues to wait for the stream until the timeout specified. When the network resumes and next call is made to wcf service from the client, we observe that wcf has not released the previous process and still waiting for the previous response. Timeouts specified in client and wcf service is as below opentimeout, closetimeout, sendtimeout, receivetimeout is set to 12 hours. The file is not released upto 12 hours. Is there any method where we while during reading the stream from wcf, if client is disconnected, terminate the process. I have been struggling from the past 2 days. Please help
Your timeouts are very large values (12 hours!!!) This is making the web service stall and keep waiting for a very long time (because you asked it to wait by setting timeouts to 12 hrs) You need to change these timeouts to few minutes(1 minute should be enough) at max as timeouts in hours does not make any sense. Read more about timeouts in below link to get a better understanding of them: https://msdn.microsoft.com/en-us/library/hh924831(v=vs.110).aspx[^]