We recently tried incorporating Response.IsClientConnected into our asp.net site, but it causes seemingly random exceptions that only show up when we check this property. If we comment out that code, we stop getting the exceptions. We get a ton of items in our log file indicating that we have disconnected clients and we are still doing processing, so it is clearly an opportunity for optimization, but we need to figure out what is going on with the exceptions first. Any idea what is causing this exception and how we can we work around it?
Our site is hosted on Windows Server 2008 r2 x64 with IIS 7.5 and .NET 4.5.
If Not Response.IsClientConnected Then ' write to log file End If
We are getting the following exception (again, seemingly random and only when we have the check for IsClientConnected live on our site):
System.Runtime.InteropServices.COMException (0x800703E3): The I/O operation has been aborted because of either a thread exit or an application request. (Exception from HRESULT: 0x800703E3)