Silverlight 2 not working on Production Web Server

Tags: .NET, Silverlight

I got some questions about why is Silverlight 2 beta not working on my production Web server? Well, one of the most errors I found is the missing MIME type definition in IIS. Silverlight 2 doesn't compile a DLL as the beta 1.1 did. The new file extension is .XAP. The only thing you have to do is following step:

  1. Open the Internet Information Services Manager (IIS Manager)
  2. Right-click on IIS and select Properties
  3. Click on the MIME-Types button
  4. Click on New... to add a new MIME-Type
  5. For file extension use .XAP and for the MIME-Type use Assembly  application/x-silverlight
    (don't miss the dot before XAP!!)

Now you are able to run your Silverlight 2 apps.

WindowClipping

 

If you cannot modify the MIME type you can simple rename the ClientBin file to .DLL. Note that you have to modify the source param, too.

 

Update: If you are using IIS7 yu can run following command. This will change the applicationHost.config in the subfolder config (section <staticContent/>):

"%systemroot%\System32\inetsrv\appcmd" set config /section:staticContent /+[fileExtension='.xap',mimeType='application/x-silverlight']

7 Comments

  • Luyan said

    How to set Assembly MIME type in IIS7(Vista)? It always say "Assembly" isn't a correct MIME type. (Normally ContentType/ContentSubtype)

  • Michael Schwarz said

    @Luyan,Lily: please use the appcmd.exe tool (see above updated post). The MIME type should by application/x-silverlight. @Dingsea: Well, it doesn't matter if the hosting provider supports this MIME type. Simple rename the file extension to .DLL and change the path to the ClientBin file, too. This will work on most Web servers. Michael

  • DaveUK said

    Fantastic ! I spent weeks trying to deploy silverlight web-apps to my hosting company's server, but they wouldn't work, probably because they haven't added the xap MIME type.So having read this I just changed from xap to DLL and it works ! Thanks Dave UK

Comments have been disabled for this content.