Server.ScriptTimeout = 0 不工作

Server.ScriptTimeout = 0 Not working

我有一个 ASP 经典脚本,它必须做很多事情(仅限管理员),包括 运行 一个需要 4 分钟才能执行的存储过程。

虽然我有

Server.ScriptTimeout = 0

在页面顶部似乎忽略了它 - 2003 和 2012 服务器。

我已尝试尽可能多地为 proc 编制索引,但它是一个下拉列表,包含常用搜索词,因此我必须清除所有黑客、性垃圾邮件等。

我不明白为什么 Server.ScriptTimeout = 0 被忽略了。

实际的错误是这样的,只是

Active Server Pages error 'ASP 0113'

Script timed out

/admin/restricted/fix.asp

The maximum amount of time for a script to execute was exceeded. You can change this limit by specifying a new value for the property Server.ScriptTimeout or by changing the value in the IIS administration tools.

它从来没有这样做过,它应该覆盖 IIS 中 30 秒的默认设置。

我已确保 proc 的命令超时为 0,因此不受限制,并且在从 proc 返回后出错。

有人有什么想法吗?

0 是 Server.ScriptTimeout 的无效值,原因有两个:

  1. ASP 页面必须有超时。他们不能无限期地运行。
  2. 根据 MSDN docs:
  3. 中的声明,ScriptTimeout 永远不能低于 IIS 中设置的 AspScriptTimeout

For example, if NumSeconds is set to 10, and the metabase setting contains the default value of 90 seconds, scripts will time out after 90 seconds.

解决此问题的最佳方法是将 Server.ScriptTimeout 设置为非常高的值。