【发布时间】:2011-11-05 11:46:29
【问题描述】:
我试图通过设置 web.config 文件让 YSlow 在“添加过期标头”部分给我一个 A。
我一直在环顾四周,这是我根据外面的情况输入的:
<staticContent>
<clientCache httpExpires="15.00:00:00" cacheControlMode="UseExpires"/>
</staticContent>
</system.webServer>
这就是我在 Firebug 中看到的:
Response Headers
HTTP/1.1 200 OK
Server: ASP.NET Development Server/10.0.0.0
Date: Sun, 28 Aug 2011 13:54:50 GMT
X-AspNet-Version: 4.0.30319
Cache-Control: private
Content-Type: image/jpeg
Content-Length: 24255
Connection: Close
Request Headersview source
Host localhost:50715
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0) Gecko/20100101 Firefox/6.0
Accept image/png,image/*;q=0.8,*/*;q=0.5
Accept-Language en-us,en;q=0.5
Accept-Encoding gzip, deflate
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
Connection keep-alive
Referer http://localhost:50715/MySite/SiteHome.html
Pragma no-cache
Cache-Control no-cache
但是,当我在 Firefox 中查看它时,即使在 Crtl-F5 之后,Yslow 仍然给出 F 分
我错过了什么?
谢谢。
【问题讨论】:
-
您是否在使用 Visual Studio 中的内置 Web 服务器(从您的标题中看起来很像)?你在 IIS7 或 IIS Express 中试过吗?
-
是的,我用的是内置的VS服务器,在IIS里没试过。你认为这就是问题的根源吗?
-
是的。我不相信内置服务器会使用你上面提到的那些设置。