Silverlight Mime types in IIS6 and Apache

If you want to host Silverlight on a web server that isn't IIS7, such as IIS6 which is the second best web server in the world (2nd to IIS7 🙂 ) you'll need to add the MIME types to support the correct content type interpretation by the browser. In the case of Silverlight this is the XAML content type - this also goes for WPF hosting as well. IIS7 has these MIME types already added but if they're not there this will result in errors such as 404.3 and prompting to download etc.

There are 3 MIME types required

  • .xaml    application/xaml+xml
  • .xap     application/x-silverlight-app
  • .xbap    application/x-ms-xbap
  • To add the MIME types to IIS6:

    1. Choose your website in IIS
    2. Open the context menu and choose "Properties"
    3. Select the register "HTTP-Header"
    4. Click on the button labeled "MIME Types..."
    5. If .xaml is not yet listed as a type, choose "New"
    6. Enter the following description:

    Extension: .xaml
    MIME type: application/xaml+xml

    7. Click "Ok",
    8. Got to 5 and add xap and xbap as above then goto 9 🙂
    9. Choose "Apply" and you're set!

    To do this in Apache 2.2: Using mod_rewite or mod_mime with AddType

    1. Open httpf.conf in your favorite text editor
    2. Search for <IFModule mime_module>
    3. Add AddType application/xaml+xml .xaml + all the other types above
    4. Close and save the httpd.conf file
    5. Gracefully restart Apache - apacectl restart or /etc/init.d/apache restart

    Note that with IIS you don't need to restart 🙂


    UPDATE: Here is an MSDN Article with even more detail on how to deploy WPF apps.

    UPDATE: And here is a page to help you script it for IIS 6

    Technorati Tags: , , , , ,

    Skip to main content