问题描述
场景:我在Visual Studio 2008开发ASP.NET MVC应用程序有一个名为存储图像和样式表内容根文件夹。当我在本地运行(使用卡西尼)和浏览我的应用程序,的每个的资源的从内容目录的总是的下载。用Firebug,我可以验证Web服务器返回一个HTTP 200(OK)。
Scenario: I have an ASP.NET MVC application developed in Visual Studio 2008. There is a root folder named "Content" that stores images and stylesheets. When I run locally (using Cassini) and browse my application, every resource from the "Content" directory is always downloaded. Using Firebug, I can verify that the web server returns an HTTP 200 ("ok").
期望:我想对于卡西尼返回HTTP 304(不修改),而不是200运行在IIS7该网站时,这是行为
Desired: I would like for Cassini to return HTTP 304 ("not modified") instead of 200. This is the behavior when running the site under IIS7.
推理:我的工作,该网站有大量的静态资源(通常多达40个每页)。浏览该网站是在IIS7非常快,因为这些资源(正确地)由浏览器缓存。然而,浏览该网站我的本地机器上是痛苦的缓慢。
Reasoning: The site I am working on has a large number of static resources (often as many as 40 per page). Browsing the site is very fast on IIS7, because these resources are (correctly) cached by the browser. However, browsing the site on my local machine is painfully slow.
这使得在不到1秒钟的IIS7页面接管30秒的渲染上卡西尼。它实际上是的更快的为我的整个网站上传每隔几分钟,测试从那里。 (是的,我承认这是不正当和疯狂。)
Pages that render in under 1 second on IIS7 take over 30 seconds to render on Cassini. It's actually faster for me to upload the entire website every few minutes and test from there. (Yes, I recognize that this is perverse and crazy.)
所以:我怎么能指示/招入卡西尼像对待IIS7的内容目录确实
推荐答案
您确定问题是缓存?因为内容没有得到我的机器上正确缓存,当我运行卡西尼号上的应用。
Are you sure the problem is caching? Because the content does get cached correctly on my machine when I run the application on Cassini.
我觉得你有可能是Firefox的下性能解析IPv6地址,这将导致如
I think the problem you're having could be Firefox's under-performance with resolving IPv6 addresses, which causes a very annoying delay on loads with addresses like http://localhost:55555.
我做什么来改变这种行为是改变 network.dns.disableIPv6
preference上 about:config中
到真正
What I did to change this behaviour was to change the network.dns.disableIPv6
preference on about:config
to true
on Firefox. I suggest trying that.
这篇关于ASP.NET MVC卡西尼上:如何可以强制"内容"目录返回304S,而不是200S?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!