Friday, October 23, 2009

Difficulty rendering silverlight chart in IIS

Came across Visifire an opensource tool to develop Silverlight Chart. For a quick start i used their designer - http://www.visifire.com/silverlight_chart_designer.php
Then added the output html files to our web application, but though the html files rendered in the browser, i was not able to browse them through IIS 6.0

Fount out that web servers are typically configured to only serve up a limited set of known file extensions as static content, but Silverlight introduces two new file extensions (.xaml for loose XAML files and .xap for the zip-based binary packaging format). So i had to add the MIME types for those file extensions to the web server so that it recognizes Silverlight content appropriately. Here are the MIME types I added to the server.

Extension MIME Type
.xaml application/xaml+xml
.xap application/x-silverlight-app

For IIS 6.0 To define a MIME type for a specific extension, follow these steps:
  1. Open the IIS Microsoft Management Console (MMC), right-click the local computer name, and then click Properties.
  2. Click MIME Types.
  3. Click New.
  4. In the Extension box, type the file name extension that you want (for example, .xaml).
  5. In the MIME Type box, type application/xaml+xml.
  6. Repeat step 4 and 5 for .xap file extention
  7. Apply the new settings and restart IIS.
Important: It is important to backup the IIS metabase before we perform any edit.