Configuring a Web Server to Host Silverlight Content

Configuring a Web Server to Host Silverlight Content

Rate This
  • Comments 12

sl_button Deploying Silverlight content to a production web server is a pretty easy process. Despite occasional misconception, Silverlight doesn't require a Microsoft-based web server: Apache can host up Silverlight content just as happily as IIS.

But there's one little gotcha: web servers are typically configured to only serve up a limited set of known file extensions as static content. That's all well and good, but Silverlight introduces two new file extensions (.xaml for loose XAML files and .xap for the zip-based binary packaging format). As a result, you need to add the MIME types for those file extensions to your web server so that it recognizes Silverlight content appropriately. Here are the MIME types you need to add to the server configuration:

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

That's all you have to do. Unfortunately, it's not possible to provide generic instructions for how to add MIME types, as it varies from server to server, but here are some links for various common web servers:

While you're updating the list of MIME types served, you might want to also add the relevant types to your web server to support WPF and ClickOnce applications. Here are the additional items you'll need:

Extension MIME Type
.manifest application/manifest
.application application/x-ms-application
.xbap application/x-ms-xbap
.deploy application/octet-stream
.xps application/vnd.ms-xpsdocument

But what if you're hosting your Silverlight application on a shared hosting service and your hoster doesn't give you access to change these settings? The good news is that there are two options available to you. Obviously, you could take advantage of Silverlight Streaming, our free hosting service for up to 10GB of Silverlight content.

Alternatively, you can "cheat" the web server by renaming the XAP file extension to a compatible MIME type. The XAP container is ZIP-based, so you can simply rename the output file from .xap to .zip and change the source param within the object tag contained in the HTML file to point to the new file location. Click on this hyperlink to see the technique in action - it's a plain HTML file that points to a ZIP file (containing the Silverlight content).

One last piece of good news: IIS 7, included in Windows Server 2008, already includes all the relevant MIME types for both WPF and Silverlight, including both .xap and .xaml extensions, so if you're using Windows Server 2008, you're all set. (The same applies to a clean install of Windows Vista SP1, although if you upgrade from the RTM to the SP1 release, your settings will remain unchanged until you uninstall and reinstall the IIS feature).

  • Following on very nicely from my last post on deploying Silverlight content to your own production server

  • Useful information once one gets a go-live license.

    Silverlight is looking like the solution for several projects we are potentially looking at now.

  • Following on very nicely from my last post on deploying Silverlight content to your own production server

  • You've been kicked (a good thing) - Trackback from DotNetKicks.com

  • The Silverlight.net website has 2 important Posts by Tim Sneath on Configuring a Web Server to Host Silverlight

  • 這幾天離開 Visaul Studio 的執行環境後,實際佈署 Silverlight 2 Beta 1 的程式到 Windows Vista 的 IIS 7 後,才發現所有網頁變成一片空白,也沒有錯誤訊息。經

  • John Stockton with a SL2 UserControl example and Tim Sneath on Web Server Configuration for SL2 content

  • Many thanks.

    Could not figure out why my xaml files did not seem to exist on the production server.

  • Hi,

    I wanted to develop a WPF project that has very intense performance requirements, and I thought it was best to consult you on this before designing the app.

    The application would be rendering data obtained from a medical hardware as charts. For this, the requirements are:

    1) Requires rendering of almost 250 points every 4 milliseconds in a chart (to be connected by a line or Bezier curve). The rendered points will also have a spectrum of colors (as in a heatmap).

    2) The rendered points would move when new data is pumped by the hardware and rendered (as in a ECG)

    3) At any given point there could be over a 150,000 moving points on the chart (because the chart window would display data of 3-5 seconds).

    4) Also later we would like to retain the history of data points of past 60 seconds or so.

    5) There could be upto 12 such chart displays running parallel at the same time in a window on the application.

    I seek your thoughts on what could be the best approach for rendering these points and animating them. Some kind of selectively invalidating the UI would be desirable here. Also what are the recommended options for storing this much data for history purpose. The problem demands something at a very low level in the WPF stack.

    Any Help would be highly appreciated,

    Thanks in Advance

  • 要部屬 Silverlight 元件到 Web Server 上是一件很簡單的事情,雖然 Silverlight 是微軟的技術,但不表示非微軟的 Web Server 就不能夠使用 Silverlight。Silverlight

  • Hi..

    Thsi is a gentle reminder..for the above query...

    Please do give in your inputs...That would be of great help..

    Thanks and Regards,

    Nirupama

  • I went to throw a small Silverlight sample application up on a web site to show to a client yesterday

Page 1 of 1 (12 items)