So it’s a Monday morning and you find out that your company’s key decision makers had some meetings with a silver tongued Architect Evangelist in the Microsoft D&PE group and they want you to deploy their first SilverLight application in your data center so they can evaluate it.   Now you are tasked with figuring out just how to do that.

I created a mini scenario using my laptop which is running Vista ultimate and has SilverLight 1.1 alpha framework loaded.    I pulled down the source code for the Video Library 1.1 sample from http://www.silverlight.net/samples/1.1/video-library/videolibrary.zip.  After unzipping it I deployed it locally and made sure everything ran fine. 

As a next step I started a VM running Windows 2003 that had no Silverlight components loaded.  Actually it had no pre-production software of any kind on it, it was just a vanilla build.  I copied all the Video Library files and folders directly to the file system on the VM then opened the IIS MMC and under Web Sites I selected New->Web Site…  I created a new site called VideoLibrary that pointed to the folder containing the VideoLibrary application and started the site.

I returned to my Vista machine, opened IE and navigated to http://myWin2003VM/default.html  .   Hmmm, nothing happened.  I checked the IIS log (\windows\system32\LogFiles) and I saw that when the Vista machine was requesting the XAML file it was getting back a 404 – file not found.  If you check out the article http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/a6031732-b4e0-4b6c-b30b-e72350e5b693.mspx?mfr=true you see that  IIS 6.0 will only serve up content that has a mime type definition.   When I open the IIS Manager and check my web site’s MIME Types (VideoLibrary->Properties->HTTP Headers->Mime Types) I see nothing in the list.  That means it is using inherited the MIME Types.  When I check the Web Sites group I saw the same thing so I checked at the Root (machine) level.  There I saw a list of all the MIME Types that are defined and as expected, there was no definition for XAML.  I then went to my Vista machine where everything was running fine and checked the MIME Type for XAML and found that the setting that I needed to add to IIS 6.0 was

                Extension = .XAML

                MIME Type = application/xaml+xml

In the IIS Manager in IIS 6.0 I right clicked my web site VideoLibrary and selected properties.   I selected the HTTP Headers tab and clicked the MIME Types button.   On that dialog I added the XAML reference.

The other thing about downloaded types that seems noteworthy are dll’s.  Silverlight 1.1 actually downloads .Net dlls that your developers write and that run in the sandbox of the browser.  Typically we are used to a bin folder on the web site that hosts all the server side dlls and the last thing we ever want is for a user to type in a direct path to a dll and have it downloaded.  In the case of Silverlight that is exactly what we are allowing the happen.  The folder that contains the client side dlls (in this example’s case ClientBin) has READ checked.   Additionally, the ClientBin folder Properties-> Home Directory tab needs to have their Execute Permission set to either “None” or “Scripts only” because if you set it to “Scripts and Executables” then IIS will try to run the DLL on the server side.   If you set this property at the site level you can still override it at the folder level (i.e.ClentBin) so that everything works properly.

Summary

There are no new server side components to install to host SilverLight applications.  The only change is a configuration change.  For IIS 5.0 and IIS 6.0 you just need to add the proper MIME type configuration to the site.  There are other new mime types that you may need to configure depending on the features you need to deploy.   http://silverlight.net/forums/t/479.aspx and http://www.cjcraft.com/Blog/2007/05/08/HowToConfigureIIS50AndIIS60ToDeploySilverlightApplications.aspx have good information about configuring the server.  If you encounter an issue you can always check the IIS log and then look for a corresponding MIME Type in the IIS Manager. 

I haven’t tried hosting this on Apache but I was assured that it works fine.   Again you would need to configure the mime types (http://httpd.apache.org/docs/1.3/mod/mod_mime.html#addtype) just like IIS but there are no special components that need to be deployed.