-->

Client Disconnected

2019-03-18 08:15发布

问题:

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)

回答1:

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.



回答2:

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..



回答3:

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?