是否可以在IIS中禁用ASP.NET网站睡眠? [英] Is it possible to disable ASP.NET website sleep in IIS?

查看:137
本文介绍了是否可以在IIS中禁用ASP.NET网站睡眠?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在IIS中运行我的网站,并且我有一些运行计时器的事件。 (我知道这是糟糕的设计,并计划重新编码,但现在我想检查是否有快速解决方案)

I run my website in IIS and I've got some running timers with events there. (I know that it's bad design and plan to recode it however for now I want to check if there fast solution)

一段时间网站即将入睡,这就是为什么我的计时器事件什么都不做。

After some time website is going to sleep and that's why my timers events do nothing.

是否有IIS设置或其他方式拒绝睡眠?

Is there IIS setting or another way to reject sleeping?

推荐答案

这可能对您有用,详见此处: -

Well this might be usefull to you as detailed here :-

http://forums.asp.net/t/ 1950241.aspx?ASP + NET + MVC +网站+去+睡觉+如何+到+ nake +它+总是+清醒+

有在.NET中设置超时的几种方法(会话超时,表单身份验证超时和IIS相关超时)。您的问题很可能与IIS Idle Timeout有关,如下所述:

There are quite a few ways to set timeouts within .NET (Session Timeouts, Forms Authentication Timeouts and IIS-related Timeouts). Your issue most likely relates to the IIS Idle Timeout as mentioned below :

在IIS中设置Application IdleTimeout属性: -

您可能需要检查IIS中的超时配置,因为此超时将覆盖web.config中定义的超时。

You may need to check what your timeout is configured for within IIS, as this timeout will override the timeouts defined in your web.config.

在IIS中有一个名为Idle Timeout的设置,默认为20分钟。这可以解释您的早期超时问题。

Within IIS there is a setting called Idle Timeout, which defaults at 20 minutes. This could explain your early timeout issue.

在IIS中配置IdleTimeout属性

Scott Hanselman还解决了奇怪的问题在此博客文章中使用表单身份验证时处理超时时可能会发生的情况。

Scott Hanselman also addresses strange issues that can occur when dealing with timeouts when using Forms Authentication in this blog post as well.

其他一些常见的超时可能是通过会话或表单身份验证,如下所示进行调整。

Some other commonly encountered timeouts might be through the Session or Forms Authentication, which would be adjusted as seen below.

在web.config中设置SessionState超时: -

您可以更新会话状态的超时属性(如果是这样的话)实际上是在你的web.config文件中超时),如下所示(默认为20分钟如下所示):

You can update the timeout property of your Session State (if that is what is actually timing out) within your web.config file in the element as shown below (default of 20 minutes shown below):

<configuration> 
 <system.web> 
 <!-- Adjust the timeout property below -->
 <sessionState mode="InProc" timeout="20"></sessionState> 
 </system.web> 
</configuration>

在web.config中设置表单身份验证超时: -

您可以通过调整web.config文件元素中的timeout属性来调整应用程序中Forms Authentication的特定超时属性。您还需要注意,如果您将slidingExpiration属性与超时结合使用,因为它们实际上可以比列出的超时更早到期。

You can adjust the specific timeout property of your Forms Authentication in your application by adjusting the timeout property within the element of your web.config file. You will also want to be mindful that if you are using the slidingExpiration property in conjunction with timeouts as they can actually expire much earlier than the timeout listed.

<authentication mode="Forms"> 
 <forms name=".ASPXAUTH" loginUrl="~/Login.aspx" timeout="yourTimeoutInMinutes"></forms> 
</authentication>

因此,如果你想延长认证令牌保持活着的数量,比如360分钟(6小时),你可以设置如下:

So if you wanted to extend the amount that the authentication token stays "alive" for to say 360 minutes (6 hours), you would set it as seen below :

<authentication mode="Forms"> 
 <forms name=".ASPXAUTH" loginUrl="~/Login.aspx" timeout="360"></forms> 
</authentication>

这篇关于是否可以在IIS中禁用ASP.NET网站睡眠?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆