作者:济河南岸_797 | 来源:互联网 | 2023-09-04 13:28
ImstrugglingwithmyIISsetupregardingcaching,heresabriefdescriptionofmyproblem:我正在为关于
I'm struggling with my IIS setup regarding caching, here's a brief description of my problem:
我正在为关于缓存的IIS设置而烦恼,以下是我的问题的简要描述:
I'm making a site for mobile and non-mobile, sharing the same controllers. IE: mysite/page will serve either mysite/page.cshtml, or mysite/M/page.cshtml, depending on the device.
我正在制作一个移动和非移动的网站,共享相同的控制器。IE: mysite/page将为mysite/page提供服务。cshtml或mysite / M /页面。cshtml,取决于设备。
Here's the catch, it worked fine with my local and integration environment (cassiini and iis 6), but on another machine (2008r2/iis 7.5), apparently there is an aggressive server-side caching policy:
这里有一个问题,它在我的本地和集成环境(cassiini和iis 6)中工作得很好,但是在另一台机器(2008r2/iis 7.5)上,显然有一个积极的服务器端缓存策略:
- If I access the website from a desktop machine, I have the correct pages (desktop version)
- 如果我从桌面计算机访问网站,我就有正确的页面(桌面版本)
- If now I use my mobile phone to access the site, I will have the desktop version, (which implies a server-side cache, my phone is not using the same network).
- 如果现在我用手机访问网站,我将有桌面版本(这意味着服务器端缓存,我的手机没有使用相同的网络)。
On the contrary, if I were to restart the server and access the site using my phone first, then I will get the mobile version on my desktop (only for the pages I already visited of course).
相反,如果我重新启动服务器并首先使用我的手机访问站点,那么我将在我的桌面上获得移动版本(当然只针对我已经访问过的页面)。
I tried 2 solutions so far:
到目前为止,我尝试了两种解决方案:
Disabling OutputCache from my Web.config:
从我的网站上禁用OutputCache。
[..]
And unchecking "Enable output cache" in "Output Caching" for my site in IIS.
在IIS中取消对我的站点的“输出缓存”中的“启用输出缓存”。
What's bugging me is that I do not have this problem with my other server (iis 6.0), although caching is enabled on this one, which leads me to think it is related to iis 7 caching addition.
困扰我的是,我的另一个服务器(iis 6.0)没有这个问题,尽管在这个服务器上启用了缓存,这使我认为它与iis 7缓存的添加有关。
My question is simple: how does one disable server-side caching on IIS 7.5?
我的问题很简单:如何在IIS 7.5上禁用服务器端缓存?
Thanks in advance for your iis lights!
提前谢谢你的iis灯!
Found it!
Sorry guys you could not really guess that one, I extend RazorViewEngine (actually I used a sample mobile mvc3 template app), and this class overrides FindView, it is supposed to take into account a useCache parameter, but apparently no matter how I configure IIS, it was set to true with iis7. I set it to false everywhere. I'll look into appropriate tuning of that parameter tomorrow.
对不起人你真的不能猜,我延长RazorViewEngine(实际上我使用一个移动mvc3模板示例应用程序),这类覆盖FindView,它应该考虑useCache参数,但显然无论我怎么配置IIS,它与iis7被设置为true。我把它设为false。我将在明天研究这个参数的适当调优。
public override ViewEngineResult FindView(ControllerContext controllerContext, string viewName, string masterName, bool useCache)
Thanks for your help guys, I have a good understanding of all the caching possibilities with IIS now ;). It's interesting that this behaves differently with IIS 7.0 (IIS6 and Cassiini were consistent).
感谢您的帮助,我现在已经很好地理解了IIS的所有缓存可能性。有趣的是,IIS6和Cassiini在IIS 7.0中的表现是不同的。
Edit:
编辑:
More info: http://aspnet.codeplex.com/workitem/8201?PendingVoteId=8201 , it is related to debug/release working of FindView.
更多信息:http://aspnet.codeplex.com/workitem/8201?。PendingVoteId=8201,与FindView的调试/发布工作有关。
This was my exact problem: http://aspnet.codeplex.com/workitem/8201?PendingVoteId=8201
这就是我的问题:http://aspnet.codeplex.com/workitem/8201?
3 个解决方案