XAP半天后就过期了?
我只是想知道什么会导致我的 xap 每半天(大约)过期。我的意思是,早上用户访问该网站,它会下载 xap 的副本,到了下午,如果该用户返回该网站,网站会为他们下载 xap 的另一个副本。
我希望用户需要下载 xap 新副本的唯一原因是他们清除了浏览器缓存或在服务器上放置了新副本。
关于问题和解决办法有什么想法吗?
我在 XAP 下载上运行 fiddler,并从 fiddler 中 xap 下载条目的缓存选项卡中获取以下行。
默认情况下,HTTP/200 响应是可缓存的,除非存在 Expires、Pragma 或 Cache-Control 标头并禁止缓存。
存在 HTTP/1.1 ETAG 标头:“2ad1d6bfdd43cb1:0” HTTP Last-Modified 标头存在:2010 年 8 月 24 日星期二 22:43:19 GMT
未提供显式 HTTP 过期信息。大多数浏览器都使用启发式过期策略: Last-Modified 和 Date 之间的 10% 增量为“02:53:34”,因此该响应将试探性地于 26/08/2010 4:39:26 PM 过期。
请问这就是问题所在吗?在哪里设置显式 HTTP 过期时间?
Im just wondering what would be causing my xap to expire every half day (approx). What i mean is that in the morning a user hits the website and it downloads a copy of the xap, by the afternoon if that user goes back to the website and the website downloads another copy of the xap for them.
I would hope that the only reason that a user should need to download a new copy of the xap would be when they have cleared their browser cache or ive put a new copy up on the server.
Any ideas on what would be the problem and fix?
I ran fiddler on the XAP download and got the following lines from the cache tab of the xap download entry in fiddler.
HTTP/200 responses are cacheable by default, unless Expires, Pragma, or Cache-Control headers are present and forbid caching.
HTTP/1.1 ETAG Header is present: "2ad1d6bfdd43cb1:0"
HTTP Last-Modified Header is present: Tue, 24 Aug 2010 22:43:19 GMT
No Explicit HTTP Expiration information was provided. Most browsers utilize heuristic expiration policies:
10% of the delta between Last-Modified and Date is '02:53:34' so this response will heuristically expire 26/08/2010 4:39:26 PM.
Would this be what the problem is? Where do I set explicit HTTP expiration?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
首先要做的是:-
这将为了解真正的问题所在提供一组非常重要的线索。
刷新时会发生什么?您是否看到第二个 XAP HTTP 会话返回状态 304 响应?如果您得到 200,请将第二次尝试的原始 Request 标头及其原始响应标头添加到您的问题中。
如果您确实收到 304,请将其保留适当的时间,然后重试,它还会给出状态 304 吗?如果没有,请与上面相同。
这些数据将为我们提供大量信息来提供诊断。
First thing to do is:-
This will provide a very important set of clues to what the real problem is.
What happens when you refresh? Do you see the second XAP HTTP session return a status 304 response? If you get a 200 add the raw Request headers for this second attempt and its raw response headers to your question.
If you do get a 304, leave it for the appropriate amount of time then try again, is it still give a status 304? If not do the same as above.
This data will give us a lot of info to provide a diagnosis.
我认为 HiTech Magic 暗示的是您需要能够在 IIS 中调整此设置。根据 Fiddler 的说法,您的 IIS 似乎没有设置内容过期时间,我认为这是默认设置。
以下是如何在 IIS 6 中执行此操作: http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/0fc16fe7-be45-4033-a5aa-d7fda3c993ff.mspx?mfr=true
以下是在 IIS 7 中执行此操作的方法:
h'ttp://technet.microsoft.com/en-us/library/cc770661(WS.10).aspx
I think what HiTech Magic was hinting at was you need to be able to adjust this setting in IIS. From what Fiddler said it seems like your IIS does not have content expiration set, which I think is the default.
here is how to do it in IIS 6: http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/0fc16fe7-be45-4033-a5aa-d7fda3c993ff.mspx?mfr=true
here is how to do it in IIS 7:
h'ttp://technet.microsoft.com/en-us/library/cc770661(WS.10).aspx
如果您使用的是 ASP.Net(您可以编辑您的帖子以让我们知道您的后端是什么吗?),请尝试使用 Response.Cache.SetCacheability。有一些陷阱,不过。
If you're using ASP.Net (can you edit your post to let us know what your backend is?), try using Response.Cache.SetCacheability. There are some gotchas, tho.