我试图在 Global.asax 的 Application_Start 方法中访问缓存。我正在尝试访问 Context.Cache。当我从 visual studio 运行代码时,它工作得很好,但是当我从 IIS 在服务器上运行它时,我得到: session 状态在此上下文中不可用。我想在应用程序启动时在缓存中植入一些值。如何从 Application_Start 获取缓存?
最佳答案
哇。我找到了答案。使用变量 HttpRuntime.Cache 而不是 Context.Cache。
关于c# - 在 Global.asax 的 Application_Start 方法中访问缓存时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/269174/