Wednesday, April 01, 2009

Silverlight Client Caching

Since SL creates a XAP file for further consumption, browsers will be caching it as a usual asset. While being awesome for production, it introduces a pain in the development process as you need to clear the temporary files in your browser to see the change.

In order to get rid of this inconvenience, just turn off the caching on the IIS level. If you are on IIS7, extend "Output Caching" options by introducing a rule for ".xap" files and specify "cache using file change notifications ":


In order to confirm it worked, fire up Fiddler and verify you get "no-cache" for the request to XAP file.