asp.net - 预计保持事件状态的连接已被 asp.net 中的服务器关闭

标签 asp.net

当我尝试重定向到下一页时,出现以下错误

注意: 即使连接打开也很好。

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/

相关文章:

asp.net - LINQ 和使用 ListView 分页

asp.net - DELETE 语句与 ASP.NET 动态数据中的 REFERENCE 约束冲突

c# - 如何在模型绑定(bind)中使用 Group By 查询

javascript - 通过 JavaScript 和回发启用后,ListBox 中的选定项目不正确

c# - 如何在 GridView 中打开 pdf

asp.net - Web 表单中的routes.IgnoreRoute 替代方案

c# - 多语言应用程序工具包填充 xlf 文件

c# - 如何允许在 GridView 中排序

c# - Gridview ItemTemplate 中的 updatePanel 在回发时存在问题

asp.net - UpdatePanel更新无触发按钮