14

I am often getting a Client Disconnected message. I don't use load balancing - only a single IIS server. I need to know what is causing this and how to fix it.

Here is the exception info:

Type: System.Web.HttpException
Message: The client disconnected.

Exception Data: 

Source: System.Web

TargetSite: Void ThrowError(System.Exception, System.String, System.String, Boolean)

StackTrace: 
   at System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError)
   at System.Web.UI.ObjectStateFormatter.Deserialize(String inputString)
   at System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String serializedState)
   at System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter, String serializedState)
   at System.Web.UI.HiddenFieldPageStatePersister.Load()
   at System.Web.UI.Page.LoadPageStateFromPersistenceMedium()
   at System.Web.UI.Page.LoadAllState()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
JSuar
  • 21,056
  • 4
  • 39
  • 83
Bob Jones
  • 475
  • 1
  • 11
  • 16
  • FWIW, looks like there's a similar question already: http://stackoverflow.com/questions/809413/what-might-be-causing-thethe-client-disconnected-asp-net-exception – Chris W. Rea Jun 11 '09 at 00:51
  • 1
    @ChrisW.Rea Yes, but this one specifies a single IIS server, where the other specifically mentions load balancing. The answer I was looking for is on this question and not the other. – Michael Dec 13 '13 at 16:38

3 Answers3

9

WE get this exception as well, and we get it in a completely repeatable way. This exception is thrown when the ViewState has become "large" and the user clicks a button before a previous request has completed...

In our case this happens very easily because the post back is using ajax, so the browser doesn't stop responding while the ViewState is being sent to the server. Clicking on this control causes the exception over and over again.

agf
  • 171,228
  • 44
  • 289
  • 238
Russell Clarvoe
  • 483
  • 4
  • 11
  • This explains why it is happening.so how to resolve this type of issues if the client requirement is like you said.or we can ignore this one? – Ajay Apr 29 '15 at 11:45
  • There are a couple of ways to reduce the impact of ViewState. One way is to create your own viewstate provider and stop sending it over the wire. Another is to disable it and do the work to make the page function without it. The most drastic way, and the path we've been headed down, is to port your pages to MVC. – Russell Clarvoe May 06 '15 at 00:01
4

This also happens when your page allows the end user to make multiple partial postbacks without waiting for the response. Meaning, Assume a table where a click on a row does a partial postback and shows him the details of that row. Now if the user one row and without waiting for details, clicks another row... chances are there this exception to occur.

The ASP.NET AJAX abandons the already executing request when a new async request is made.

However What remains ununderstood is why does IIS allow such abandoned request to reach ASP.NET at all..

humblelistener
  • 1,456
  • 12
  • 22
1

It's possible that users are aborting the page post-back by clicking STOP or RELOAD in the browser. Does your application have some pages that are quite heavy, e.g. lots of viewstate, and do you have users that are on slower connections, e.g. dialup?

Chris W. Rea
  • 5,430
  • 41
  • 58
  • This is not what is happening. All local connections are 100MB/1GB and this happens on many different pages. We do use lots of viewstate and there is no effective way around that. The problem seems to occur almost randomly. – Bob Jones Jun 11 '09 at 15:03
  • What is the use case that you actually need to stop this error from happening? – s_hewitt Nov 14 '09 at 20:04