Posted 1 November 2008 Tweet
If you host XAP files on a CDN or other host (such as Amazon S3), you need to have the server configured with the new Silverlight MIME type. You can find out specifics in the breaking changes reference.
When you do not need to configure the MIME type:
But, if you want to share or enable embedding for others, you need to add the "application/x-silverlight-app" MIME type for your .Xap files.
This will allow:
Equally important, if you don't want others to directly link to and reference your .Xap from their domains, then make sure to not send this mime type.
For global configuration, in your central mime.types file, add:
# Enable Silverlight support for our apps to be embedded anywhere
Then restart Apache:
$ sudo ./apachectl restart
If you're just configuring at the directory level, edit or add the .htaccess file in the directory you want to serve anywhere, and add the line:
AddType application/x-silverlight-app xap
IIS 6 & 7
Here's a nice step-by-step guide to adding the MIME type on Windows web servers.
Maybe not a true CDN, I do use Amazon's Simple Storage Service (S3) for most of my Silverlight application hosting.
Amazon S3 records the MIME type that your S3 client sends with each file upload. This means that you must configure your system with the appropriate "application/x-silverlight-app" MIME type when you upload, or when clients download your .Xap, they will get an unknown MIME type and be greeted with blank space where you'd expect your app to be working.
I'd highly recommend that you download and use Fiddler2 on your Windows system. Using it, you can make sure and see what the content type is when it comes back in an HTTP response.
Jeff Wilcox is a Principal Software Engineer at Microsoft on the Azure team.
Jeff holds a BS in Computer Science from the University of Michigan.