ASP.NET UpdatePanel 超时
我正在从 UpdatePanel
发出请求,该请求需要超过 90 秒。 我收到此超时错误:
Microsoft JScript 运行时错误: Sys.WebForms.PageRequestManagerTimeoutException:服务器请求 超时。
有谁知道是否有办法增加呼叫超时之前的时间?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
ScriptManager 上有一个属性允许您设置超时(以秒为单位)。 默认值为 90 秒。
There is a property on the ScriptManager which allows you to set the time-out in seconds. The default value is 90 seconds.
就我而言,ScriptManager 对象是在母版页文件中创建的,然后与内容页文件共享。 因此,要更改内容页面中的 ScriptManager.AsyncPostBackTimeout 属性,我必须访问内容页面的 aspx.cs 文件中的对象:
In my case the ScriptManager object was created in a Master Page file that was then shared with the Content Page files. So to change the ScriptManager.AsyncPostBackTimeout property in the Content Page, I had to access the object in the Content Page's aspx.cs file:
这成功了(基本上只是忽略所有超时):
This did the trick (basically just ignoring all timeouts):
请按照以下步骤操作:
步骤 1:在 web.config 中,设置
httpRuntime maxRequestLength="1024000"executionTimeout="999999"
步骤 2:将以下设置添加到您的网站页面的 ScriptManager:
AsyncPostBackTimeout ="360000"
这将解决您的问题。
Please follow the steps below:
Step 1: In web.config, set
httpRuntime maxRequestLength="1024000" executionTimeout="999999"
Step 2: Add the following setting to your web page's ScriptManager:
AsyncPostBackTimeout ="360000"
This will solve your problem.
这可以通过更改 IIS 中的 ASP 脚本超时进行配置。
它位于网站属性、虚拟目录、配置按钮中,然后位于选项选项卡上。
或通过设置 Server.ScriptTimeout 属性来设置它。
This might be configurable by changing the ASP script timeout in IIS.
It's located in the properties of your web site, virtual directory, configuration button, then on the options tab.
or set it by setting the Server.ScriptTimeout property.
好吧,我想如果您只是希望丢弃该请求,并且可能永远不会完全执行,那么这会起作用...
将 AsyncPostBackTimeOut 属性添加到 ScriptManager 标记,以将默认超时从 90 秒更改为对您的应用程序更合理的值。
此外,考虑更改接收呼叫的 Web 服务以加快速度。 90秒对于互联网时间来说可能是无限的。
Well, I suppose that would work if you just want the request thrown away with the potential that it never completely executed...
Add an AsyncPostBackTimeOut property to the ScriptManager tag to change your default timeout from 90 seconds to something more reasonable for your application.
Further, look into changing the web service receiving the call to move faster. 90 seconds may as well be infinity in internet time.
您面临的问题是当您的应用程序在 SQL 数据库查询上遇到超时时。 返回输出需要比默认时间更多的时间。 所以需要增加ConnectionTimeout属性。
您可以通过多种方式完成此操作:
连接字符串具有
ConnectionTimeout
属性。 该属性决定代码等待打开数据库连接的最大秒数。 您可以在web.config
的连接字符串部分设置连接超时。您可以将
AsyncPostBackTimeout="6000"
放入.aspx
页面您可以在
SqlCommand
中设置超时,您在其中调用 .cs 文件中的存储过程。希望你有解决办法!
The problem you are facing is when your application runs into a timeout on a SQL database query. It's taking more time than the default to return the output. So you need to increase the ConnectionTimeout property.
You can do it in several ways:
A connection string has a
ConnectionTimeout
property. It is a property that determines the maximum number of seconds your code will wait for a connection of the database to be opened. You can set connection timeout in connection string section inweb.config
.You can put
AsyncPostBackTimeout="6000"
in.aspx
pageYou can set timeout in
SqlCommand
, where you are calling the stored procedure in .cs file.Hope you have a solution!