gpt4 book ai didi

asp.net - 如果用户在 ASP.NET 页面中保持空闲状态,则会出现白屏问题

转载 作者:行者123 更新时间:2023-12-02 14:56:04 25 4
gpt4 key购买 nike

在我们的 ASP.NET 网站中,其中一个页面有一些选项卡。每个选项卡代表不同的内容,从一个选项卡移动到另一个选项卡会重新加载整个页面。 如果我当前位于其中一个选项卡中,并在那里闲置大约一分钟或更长时间,然后转到另一个选项卡,则只会出现一个白色的空白屏幕。(没有页面源代码)浏览器中的信息)。

遗憾的是,在较低的测试环境中,同一网站根本无法重现同样的问题。问题仅发生在网站的生产版本中。

是否有我应该更改的 IIS 设置或 web.config 设置来解决此问题。因为我相信相关网页的源代码不会成为原因。

最佳答案

这可能是因为 session 超时已达到结束 session 的限制。

在这种情况下,您有三种可能的解决方案:

第一

您可以尝试编辑位于应用程序根目录下的 web.config 文件来延长 session 超时。尝试这样的事情:

<sessionState mode="StateServer" timeout="500">

</sessionState>

根据MSDN您可以将超时设置为最多525,601分钟(1年)。

第二

如果它不起作用并且您有访问权限,您可以尝试在 IIS 上编辑超时:

Open the IIS, click on the Application Pools, Select the Application pool for your application.

Right Click on that, Select Properties.

In the Performance tab, Set the idle timeout as your desired minutes for "shutdown worker processes after being idle for ..... minutes".

IMPORTANT: Apart from this you have to set the timeout in web.config as said above.

第三

您可以创建一个在后台执行的 ajax 函数,以防止 session 过期:

function keepSessionAlive(mod) {
mod.open("GET", "blank.html", true);
mod.onreadystatechange = function() {
if (mod.readyState == 4) {
document.getElementById("#blankDiv").innerHTML = mod.responseText;
}
};
mod.send(null)
}
setInterval('keepSessionAlive()', 100000);

就是这样。希望对您有所帮助。

关于asp.net - 如果用户在 ASP.NET 页面中保持空闲状态,则会出现白屏问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16081946/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com