Error: Sys.InvalidOperationException: InitializeError error #2104 in control '[insert my control id here]': Could not download the Silverlight application. Check web server settings
So of course i googled the error message. It turns out this one is very easy to solve, but there is a bit of random rubbish and partial answers floating around out there. It turns out that IIS would not serve the control to the browser because i had not set up the correct MIME types in IIS, so IIS had no idea what the browser was requesting.
The best solution i found was this blog post: http://web.iotap.com/Blogs/tabid/277/EntryId/65/Configuring-Silverlight-2-0-Application-in-IIS.aspx
You need to ensure that the website hosting the Silverlight control has the following MIME types registered:
Extension | MIME type |
.application | application/x-ms-application |
.deploy | application/octet-stream |
.manifest | application/manifest |
.xaml | application/xaml+xml |
.xap | application/x-silverlight-app |
.xbap | application/x-ms-xbap |
.xps | application/vnd.ms-xpsdocument |
Realistically you probably only need the xaml and xap entries, but i entered them all and the demo gods smiled once again. Once you have done that, Ctrl-F5 your web page (or just F5 for some other browsers), and you should see your Silverlight control appear.
As per that blog article, i also enabled the content expiration, but i'm not sure of the relevance of that in this particular case (maybe it stops the Silverlight control from being cached?).
keywords: silverlight 2, deploy, error 2104, silverlight mime types