Unhandled Error in Silverlight 2 Application Code: 2104


Problem: After deploying your silverlight application to your Web server you get the following error.

Error: Unhandled Error in Silverlight 2 Application
Code: 2104   
Category: InitializeError
Message: Could not download the Silverlight application. Check web server settings    
Source File: TestPage.html
Line: 53

Solution: The MIME types on your webserver are not setup correctly to host your silver light application. The MIME types needed are:

.xaml    application/xaml+xml
.xap    application/x-silverlight-app
.xbap    application/x-ms-xbap

Hack: If you are like me and have your silverlight hosted on a shared hosting environment like godaddy you cannot change your MIME types. Instead change the .xap to .zip you must also change the source parameter value inside your page to match.

<object data="data:application/x-silverlight," type="application/x-silverlight-2" width="100%" height="100%">
    <param name="source" value="Microsoft.Windows.Controls.Samples.zip"/>
    <param name="onerror" value="onSilverlightError" />
    <param name="background" value="white" />
    <param name="minRuntimeVersion" value="2.0.31005.0" />
    <param name="autoUpgrade" value="true" />
    <a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;">
        <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none"/>