问题描述
当我尝试重定向到下一页时,出现以下错误
When i try to redirect to next page, I get the following error
注意: Even the connection is open and it is fine.
异常详细信息:System.Net.WebException
:基础连接已关闭:服务器关闭了预期保持活动状态的连接.
Exception Details: System.Net.WebException
: The underlying connection was closed: A connection that was expected to be kept alive was closed by the server.
源错误:
堆栈跟踪:
[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;
Version Information: Microsoft .NET Framework Version:4.0.30319;
ASP.NET版本:4.0.30319.272
ASP.NET Version:4.0.30319.272
推荐答案
此MSDN帖子似乎描述了类似情况.让我们知道它是否符合您的问题:
This MSDN post seems to describe a similar situation. Let us know if it matches your issue:
报价:
.Net的印象是,无论如何它已经发送了数据,但是服务器发送了Connection:关闭,因此它显示错误而不重新发送请求.
.Net is under impression that it has anyway already sent the data but server sent Connection : Close so it shows error without resending(sic) the request.
因此对我来说上述解决方案是
So the solution for the above that worked for me was
System.Net.ServicePointManager.Expect100Continue = False
如果要查看闯入者之间的流量,请使用Wireshark或类似工具侦听HTTP交换.
If you want to see the traffic between the interlopers, snoop the HTTP exchange with Wireshark or a similar tool.
这篇关于asp.net中的服务器关闭了预期保持活动状态的连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!