Reset Static variables in IIS

≡放荡痞女 提交于 2019-12-13 16:24:48

问题


I have assigned value for static variable in Application start event of ASP.NET MVC application.

protected void Application_Start()
{
   public static list<string> versionInfo = VersionAccess.LoadVersionInfo();
}

In this static variable "versionInfo" assigned list of some values that get from database. Used this static variable throughout the mvc application.

This is working fine when i hosted this app in IIS. And later i have added some more values in database. So the static variable values have to be reset with some new extra values. Then i have restarted the IIS and the new values will be affected. But some time later, this will go back to previous state, static variable value changed to old value before database update.

IIS restart will be effective for some times, later some times i can't see the new values. Cached static variable value at the first time i hosted the application remains.

I have tried removing temporary asp.net mvc files from the Server, and also recycled the Application pool, and restarted the IIS through command prompt.

In all cases, some times only i can find the new changes, then go back to previous state. This is working perfectly in localhost.

Can anyone please give me a solution?

Regards, Karthik.

来源:https://stackoverflow.com/questions/14958214/reset-static-variables-in-iis

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!