Silverlight 2 not working on Production Web Server

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']

Published Friday, March 7, 2008 12:36 AM by Michael Schwarz
Filed under: ,

Comments

# re: Silverlight 2 not working on Production Web Server

Friday, March 7, 2008 2:54 AM by Luyan

How to set Assembly MIME type in IIS7(Vista)?

It always say "Assembly" isn't a correct MIME type.

(Normally ContentType/ContentSubtype)

# re: Silverlight 2 not working on Production Web Server

Friday, March 7, 2008 3:15 AM by Lily

How to do in IIS7? It only allow ContentType/ContentSubType format.

# re: Silverlight 2 not working on Production Web Server

Friday, March 7, 2008 3:22 AM by dingsea

have you depolied your SL2.0 in a web server successfully?

do you know which web hosting provider is supporting 2.0?

# re: Silverlight 2 not working on Production Web Server

Friday, March 7, 2008 4:27 AM by Michael Schwarz

@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

# re: Silverlight 2 not working on Production Web Server

Wednesday, March 12, 2008 1:20 AM by Brad Abrams

Another tip if you can't change the mime-types on the server... just change the .xap to .zip (and the reference in your Xaml files) and it will work just fine..  

# re: Silverlight 2 not working on Production Web Server

Monday, March 24, 2008 1:39 PM by Dedicated Hosting Provider

Thanks for the tips. Also, Brad's way works just fine as well. Good blog!

# re: Silverlight 2 not working on Production Web Server

Monday, May 5, 2008 11:06 AM by Kesavan

I got same issue.

Thanks for your comments.Now it's working very well.

# re: Silverlight 2 not working on Production Web Server

Friday, May 16, 2008 3:36 PM by DaveUK

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