在ASP.NET MVC中静态字段 [英] static field in ASP.NET MVC

查看:168
本文介绍了在ASP.NET MVC中静态字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有在ASP.NET MVC控制器大对象静态字段。用于第一请求I初始化这个字段,这是可用于下一查询。但是,等待10-20分钟后该字段为空。有什么想法?
我使用ASP.NET MVC 1和IIS 7。

I have static field with large object in ASP.NET MVC controller. For the first request i initialize this field and it is available for the next queries. But after waiting 10-20 minutes this field is null. Have any ideas ? I use ASP.NET MVC 1 and IIS 7.

在此先感谢...

推荐答案

您的应用程序池回收大概

Your application pool is probably recycling.

您应填充任何全局像这样的Application_Start,这样,他们将在随后的请求被重新加载,即使池回收。

You should be populating any globals like this in application_start, that way they will be reloaded on subsequent requests, even if the pool recycles.

默认如果有几分钟它将被卸载没有活动,导致应用程序必须从头开始重新加载。您可以prevent或在IIS管理配置应用程序池设置减少应用程序池回收的occurances。

By default if there is no activity for a few minutes it will be unloaded, causing the application to have to be reloaded from scratch. You can prevent or reduce the occurances of the application pool recycling by configuring the application pool settings in IIS Administration.

这篇关于在ASP.NET MVC中静态字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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