刷新 AppDomain 时 ASP.NET 保留缓存
当代码更改发布到 .NET 网站时,重新编译过程涉及重新启动 AppDomain,这反过来会擦除应用程序缓存。
发生这种情况时是否会引发任何事件?有没有办法手动序列化部分缓存数据并将其保存到磁盘,然后在再次加载应用程序时重新初始化缓存?
When code changes are published to .NET websites the re-compilation process involves restarting the AppDomain, this in turn wipes the application cache.
Are there any events raised when this happens? Is there any way to manually serialise portions of my cached data and save it to disk, then subsequently re-initialise the cache when the application is loaded again?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 MS AppFabric 缓存,它是 Windows Server 的免费组件,并通过将缓存与 ISS 应用程序域解耦来解决此问题。
请参阅此处的问题和答案:AppFabric vs System.Runtime.Caching
if如果您继续使用 ASP.NET 缓存,您就会遇到上述问题,据我所知,没有解决方案。
you can use MS AppFabric caching, it's a free component for Windows Server and solves this by decoupling the caching from the ISS app domain.
see question and answers here: AppFabric vs System.Runtime.Caching
if you keep using ASP.NET Caching you are exposed at the issues you have described above and to my knowledge there is no solution.