Preserving ASP.NET Application State Across Restarts

天涯浪子 提交于 2020-01-03 17:50:37

问题


Any good way to preserve ASP.NET Application state across restarts?

I want to be able to set some values restart the app and have them still be there. I want to primarily do this for small "throw-away" test web apps that don't even need a database.

Is there some way to do it with static members and serialization? web cache?

UPDATE:
Application should be able to update these values.
Values could be custom objects like:

public class Person    
{  
  public string FirstName { get; set; }  
  public string LastName { get; set; }      
}  

回答1:


You need some sort of persistent data storage, whether that's a database, xml files or something else.

You might be interested in the SimpleRepository with SqlLite from SubSonic which gets pretty close to what you describe.




回答2:


Why not just use the ASP.NET State Service:

http://msdn.microsoft.com/en-us/library/ms972429.aspx

Am I missing something?




回答3:


I believe that you can store the ASP .NET session in a SQL Server Server database. I'd imagine that would persist it across application restarts, or even shutdowns/reboots.



来源:https://stackoverflow.com/questions/1279561/preserving-asp-net-application-state-across-restarts

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