什么会阻止 ASP.NET 进行输出缓存?
我有一个 ASP.NET 应用程序,并且正在尝试输出缓存某个页面,但是对于每个请求,调试器仍然会调用 OnLoad 方法,并且我会收到 200 响应。
我已将输出缓存指令放置在页面上,如下所示:
<%@ OutputCache Duration="60" VaryByParam="None" %>
并确保我拥有 OutputCache 模块
<add name="OutputCache" type="System.Web.Caching.OutputCacheModule"/>
并且还绕过了 URL 重写以防万一。我已经使用 Cassini 和 IIS 5.1 (XP) 尝试过此操作,但是该页面根本不缓存。
还有其他我没有考虑过的因素可能会影响此功能吗?
谢谢
I have an ASP.NET application, and am trying to output cache a certain page, however on every request, the debugger is still hitting the OnLoad method and I get a 200 response back.
I have placed the output cache directive on a page like so:
<%@ OutputCache Duration="60" VaryByParam="None" %>
And ensured I have the OutputCache module
<add name="OutputCache" type="System.Web.Caching.OutputCacheModule"/>
And have also bypassed URL rewriting just in case. I have tried this using Cassini and IIS 5.1 (XP), however the page is not caching at all.
Are there any other factors which I have not looked at which could affect this feature?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我也有同样的问题。我发现在处理我无法缓存的请求时调用了这行代码:
注释掉此代码使输出缓存再次开始工作。我猜想上面的行只会影响发送到客户端/浏览器的标头。确保在页面生命周期的任何时刻都不会执行类似的操作。
I had the same problem. I found this line of code being called while handling the request that I couldn't cache:
Commenting this out made Output caching start working again. I would have guessed that the line above would only affect Headers sent to the client/browser. Make sure nothing like this is being executed at any point in the page life-cycle.