当我尝试重定向到下一页时,出现以下错误
注意: 即使连接打开也很好。
The underlying connection was closed: A connection that was expected to be kept alive was closed by the server. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details:
System.Net.WebException
: The underlying connection was closed: A connection that was expected to be kept alive was closed by the server.
来源错误:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
堆栈跟踪:
[WebException: The underlying connection was closed: A connection that was expected to be kept alive was closed by the server.]
Effrtpartsigndone.Page_Load(Object sender, EventArgs e) +8196
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +91
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207
版本信息:Microsoft .NET Framework 版本:4.0.30319;
ASP.NET版本:4.0.30319.272
最佳答案
这可能是因为客户端的超时时间大于服务器的超时时间。服务器关闭连接,客户端仍在等待响应或发送请求。
您必须将 KeepAlive 属性设置为 False,以便连接将自行关闭并针对每个请求重新打开。 这将避免尝试使用关闭连接的问题。
关于asp.net - 预计保持事件状态的连接已被 asp.net 中的服务器关闭,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14052218/