如何避免我在ASP.NET中的网页响应超时?

问题描述 投票:1回答:3

我从Excel导入大量数据(100.000行等),并从excel中获取必要的值(大约需要1分钟)

然后我在这些记录中循环并执行一些数据库插入/更新语句。但大约90秒后响应停止。我的页面停止但在后台数据库继续并执行插入/更新作业。

但我不能给用户一个反馈(你的过程是完整的或等等),因为响应已经结束(timedout)。

我尝试在web.config中增加超时:

<httpRuntime maxRequestLength="10240" executionTimeout="36000"/>

我也尝试为这个特定页面增加executionTimeout,如下所示:

<location path="HomePage.aspx"> <!--Excel import takes too long-->
  <system.web>
    <httpRuntime executionTimeout="360000" maxUrlLength="10000" maxQueryStringLength="80000" maxRequestLength="10240" />
  </system.web>  
</location>

他们没有工作!有什么建议?

asp.net timeout response execution-time
3个回答
2
投票

protected void Page_Load(object sender,EventArgs e){ScriptManager.GetCurrent(this.Page).AsyncPostBackTimeout = 6000;

我将AsyncPostBackTimeout增加到6000,这对我有用。我的linkbutton(长进程)在UpdatePanel中


1
投票

试试这种方式

<configuration>
  <system.web>
  ...
   <sessionState timeout="90" />
  ...
 </system.web>
</configuration>

看到这个

http://asp-net.vexedlogic.com/2012/05/23/aspasp-net-session-timeout-how-do-i-change-it/

http://forums.asp.net/t/1040377.aspx/1


0
投票

下面的代码似乎只能与webconfig更改一起使用。

protected void Page_Load(object sender, EventArgs e) { ScriptManager.GetCurrent(this.Page).AsyncPostBackTimeout = 6000;
}

没有它,它对我不起作用。

<httpRuntime maxRequestLength="102400" executionTimeout="36000" />
© www.soinside.com 2019 - 2024. All rights reserved.