问题
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