Configuring IIS for Silverlight Applications

In: Hosting| IIS| IT| Microsoft| Uncategorized| Web| Windows Server| Windows Server 2003

14 Jan 2010

silverlightYou can simply add Silverlight support to your IIS6 webserver running on Windows Server 2003.

To enable IIS 6.0 in Windows Server 2003 or IIS7 in Windows Vista RTM with the appropriate MIME Types, add:

  • .xap     application/x-silverlight-app
  • .xaml    application/xaml+xml
  • .xbap    application/x-ms-xbap

Adding MIME Types by a simple VB script:

  • Here is a VBS script you could run to enable each of these types:


Const ADS_PROPERTY_UPDATE = 2
'
if WScript.Arguments.Count < 2 then
WScript.Echo "Usage: " + WScript.ScriptName + " extension mimetype"
WScript.Quit
end if
'
'Get the mimemap object.
Set MimeMapObj = GetObject("IIS://LocalHost/MimeMap")
'
'Get the mappings from the MimeMap property.
aMimeMap = MimeMapObj.GetEx("MimeMap")
'
' Add a new mapping.
i = UBound(aMimeMap) + 1
Redim Preserve aMimeMap(i)
Set aMimeMap(i) = CreateObject("MimeMap")
aMimeMap(i).Extension = WScript.Arguments(0)
aMimeMap(i).MimeType = WScript.Arguments(1)
MimeMapObj.PutEx ADS_PROPERTY_UPDATE, "MimeMap", aMimeMap
MimeMapObj.SetInfo
'
WScript.Echo "MimeMap successfully added: "
WScript.Echo " Extension: " + WScript.Arguments(0)
WScript.Echo " Type: " + WScript.Arguments(1)

  • If you copy and paste the code above into a VBS file and save it as ADDMIMETYPE.VBS the syntax to add each type would be:

ADDMIMETYPE.VBS .xap application/x-silverlight-app ADDMIMETYPE.VBS .xaml application/xaml+xmlADDMIMETYPE.VBS .xbap application/x-ms-xbap

or you could add it very simple over the IIS Manager.

1 Response to Configuring IIS for Silverlight Applications

Avatar

Joseph

March 4th, 2010 at 10:46 pm

I got an “Invalid Sytax” from GetObject(“IIS://LocalHost/MimeMap”) when running on 2008 server

Comment Form

about thomasmaurer.ch

Thomas Maurer

Thomas Maurer.
Born in 1986. live in Diegten. Switzerland. work as a System Administrator in Allschwil(Switzerland). interested in in Apple, IT, TV, Movies, Design and Art.

Follow me on twitter

My Tweets

Latest Photos

IMG_0019DSCN0078DSCN0077DSCN0325.JPGDSCN0324.JPGDSCN0323.JPG

Ad