4

I have a sample program which does nothing but Hello World. I open IE and go to my development environement and access the silverlight, it loads the XAP first time and then if I close IE and open again, XAP does not get downloaded. Since there are no changes I expect it not to download.

After deploying it in QA environement, I open IE for the first time, it load XAP as expected. Now close IE and open again, I expect it not to download XAP but it does download XAP again. But if I would do refresh on the page it does not download XAp. So this happens only on Fresh IE open in our QA environment.

All the above tests are done on the same box with same IE setting. So there is no client side IE cache issue. I did check the date and Time on the servers to see if there is any difference as specified in silverlight XAP gets downloaded everytime link and our servers are in same date and time.

Does any one know how to prevent IIS not to download everytime?

Community
  • 1
  • 1
Nair
  • 7,438
  • 10
  • 41
  • 69

1 Answers1

4

The default settings in IE mean that a fresh instance of IE will always attempt to fetch each unique URL when it is first encountered. IE does this even if the cache headers sent with the resource the last time it was fetched would indicate the resource is still fresh.

However IE will send If-Modified-Since and/or If-None-Match when it re-requests a resource that it has a copy of in its cache. Hence the server has the option of responding with 304 Not Modified, are you sure that is not happening? The 304 has no entity body and is therefore a cheap response.

Note also that IE can make some strange heuristic choices if the server fails to send any cache control headers with a resource. One of these choices is where the resource is quite large no caching is performed.

If you haven't already done so I would recommend you set some reasonable Expiration on the ClientBin folder in IIS Manager (in IIS7 select the ClientBin folder, select "HTTP Response Header", open "Set Common Headers..", enable Expire Web content.

AnthonyWJones
  • 187,081
  • 35
  • 232
  • 306
  • Only in data center, we are not getting 304 while in development servers with fiddler I can see 304 response. I will check the enable expore web content and update back. – Nair Jul 22 '11 at 03:31
  • We enabled the enable expire web content to 10 hours, still did not work. – Nair Jul 22 '11 at 13:55
  • Let me correct my previous comment, by changing the response header expiration did work. But we couldn't set it at ClientBin level, I have to do it at web site, level. Is it not possible to do it at ClientBin? – Nair Jul 22 '11 at 15:53
  • @Nair: Yes it is possible, IIS would be pretty rubbish if you could only configure expiration at the whole site level. What version of IIS are you using? – AnthonyWJones Jul 22 '11 at 15:57
  • @Nair: The UI for IIS manager is quite different on IIS6. Right mouse on the ClientBin folder in the IIS manager and select "Properties" from the context menu. In the Properties dialog that pops up select the "HTTP Headers" tab. There you can "Enable Content Expiration". – AnthonyWJones Jul 22 '11 at 16:59
  • I was able to do what you suggested, but I did find the real culprit in my case http://csharprambling.wordpress.com/2011/07/26/what-makes-xap-to-download/ – Nair Jul 26 '11 at 17:17
  • @Nair: You can get this problem with even a single IIS server at times. If the Metabase version changes on the server the ETag changes so you end up having to fetch all the content again. But IE, at least previous versions of IE I haven't checked IE9, would not update the ETag of the current resource. So for an indefinite period you are left with all the content continually being fetched regardless of what is in the cache. – AnthonyWJones Jul 26 '11 at 19:43