Thursday, March 31, 2011

Does Silverlight download the assemblies everytime?

Does a Silverlight application get downloaded everytime you visit the site or will it check version/size information and only download a newer version of files?

From stackoverflow
  • It depends on how you configured your webservers headers and how the client configures his browser caching policies.

    Usually the browser settings are ok by default. You might want to check your webserver that the appropriate header values for expiration, etags and caching are properly configured. You can use a tool like Firebug to check these settings and use Yslow to meassure other client side performance things.

    Phil Wright : So this is determined by standard web settings and nothing that is Silverlight specific then?
    BenMaddox : That's correct Phil.
  • There is nothing specific to Silverlight 2 in this regard, the most concise explanation I've read is from this post on silverlight.net:

    "Silverlight falls under the same caching rules as any other web content. If the user clears their cache, your xap will have to be downloaded again. In normal circumstances, the xap is downloaded only when changed or when the cache expires."

    You can control when the cache expires by following the steps outlined here:

    You can turn the Enable Content Expiration HTTP header option on for your XAP file. Open IIS Manager, goto Default Web Site and find your Web site for the silverlight project. Find the XAP file under ClientBin. Goto the properties page of the XAP file, on HTTP Headers Tab, Turn on "Enable Content Expiration", click the "Expire Immediately" radio button. Save the change.

    This way the new XAP (only there is a new XAP) will get downloaded when you refresh your page without having to close the browser.

    This related post may also be of interest.

0 comments:

Post a Comment