c# - 即使调试设置为 true,asp.net mvc 应用程序在生产中也会超时。谁可以帮我这个事
问题描述
我们有一个 ASP.Net MVC 应用程序。它已在生产环境中发布,并且在 WEb.config 中将 debug 设置为 true(不确定原因)。
compilation batch="true" debug="true" targetFramework="4.5"
但是应用程序仍然超时。
我想制作debug="false"
并添加以下标签。
httpRuntime executionTimeout="43200" maxRequestLength="104856" targetFramework="4.5"
但是,如果应用程序超时,debug="true"
那么我认为即使debug="false"
与 executionTimeout 无关,它也会超时。
有什么方法可以通过 Global.asax.cs 设置超时?
编辑 1:如果进程运行超过 2 分钟,应用程序会超时。
所以这意味着会话仍然存在。
<sessionState mode="InProc" cookieless="false" timeout="60" />
对于数据库,我添加了 5 分钟的命令超时(仅用于测试目的),但仍然存在超时。
编辑2:浏览日志后,这是错误。
The remote host closed the connection. The error code is 0x800703E3
解决方案
用户会话可能正在结束,这可能会使其他一切变得无关紧要:
在 IIS 中设置: sessionState timeout="120"
或 Web.config:
<configuration>
<system.web>
<sessionState mode="InProc" timeout="120"></sessionState>
</system.web>
</configuration>
默认值为 20 分钟,因此您的 12 小时 httpruntime executiontimeout 将无关紧要。
如果您有长时间运行的脚本,请确保您有足够的初始数据库连接和命令超时的连接超时。检查日志并加载一个不依赖数据库的页面作为测试。
此外,Microsoft 文档指出:
“仅当元素中的 debug 属性设置为 false 时,此超时才适用。”</p>
因此,在 debug 当前设置为 true 的情况下,executiontimeout 设置将不会执行任何操作,直到 debug 更改为 false。
推荐阅读
- sql - 在 cosmos db 中将字符串转换为日期时间
- c - CS50 复数 PSET3 - 代码似乎有效,但 check50 另有说明
- python - 将列表的元素插入到另一个列表的中间
- flutter - 需要帮助在颤振代码中复制设计
- java - 如何解决 tanukisoftware 包装器中的“WrapperSimpleApp: Unable to locate the class ...”
- sql - 连接两个表并获取女性计数大于男性计数的部门名称
- python - 使用 python 改进将数据帧加载到 postgress db
- .htaccess - .htaccess 重写规则代码也无法正常工作
- python - 我试图使用 tensorflow 在自定义数据集上实现对象检测
- ios - 如何在导航栏swift ui中设置左右按钮(前导/尾随)?