Code Simplified – Viral Sarvaiya

Code Simplified – Viral Sarvaiya, Web Developer Friends, dot net Developer, Sql Server Developer

Configuring IIS for Silverlight Applications

Posted by Viral Sarvaiya on September 9, 2010

Microsoft® SilverlightTM is a cross-browser, cross-platform plug-in for delivering the next generation of .NET-based media experiences and rich interactive applications for the Web. Silverlight offers a flexible programming model that supports AJAX, VB, C#, Python, and Ruby, and integrates with existing Web applications. Silverlight supports fast, cost-effective delivery of high-quality video to all major browsers running on the Mac OS or Windows.

In most cases, hosters do not need to perform particular deployments to support Silverlight. However, check for the following basic items that could prevent Silverlight from functioning correctly.

MIME Types

IIS 7 in Windows Server 2008

All MIME types needed to support Silverlight are implemented by default in IIS 7 in Windows Server 2008 and Windows Vista SP1.  Windows Vista customers can add MIME types by running IIS Manager, clicking MIME Types, then clicking Add, and then adding the following MIME types:

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

Alternatively, you can add the following MIME types to your %windir%\system32\inetsrv\config\applicationHost.config file in the <staticContent> section.

<mimeMap fileExtension=”.xaml” mimeType=”application/xaml+xml” />
<mimeMap fileExtension=”.xap” mimeType=”application/x-silverlight-app” />
<mimeMap fileExtension=”.xbap” mimeType=”application/x-ms-xbap” />

In Windows Server 2003 IIS 6.0

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

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

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

Using the IIS Manager User Interface in IIS 6.0 in Windows Server 2003

1. Go to Start\Administrative Tools and run IIS Manager. See the figure below:

2. Right click on the server name and select Properties. See the figure below:

3. In the Properties dialog box, click MIME Types. See the figure below:

4. In the MIME Types dialog box, click New. See the figure below:

5. In the MIME Types dialog box, enter one of these MIME types:

  • .xap     application/x-silverlight-app
  • .xaml    application/xaml+xml
  • .xbap    application/x-ms-xbap
  • See the figure below:

    For detailed information Click to visit http://silverlight.net and http://learn.iis.net/page.aspx/262/configuring-iis-for-silverlight-applications/

    Advertisements

    One Response to “Configuring IIS for Silverlight Applications”

    1. […] This post was mentioned on Twitter by Larry King, Viral Sarvaiya. Viral Sarvaiya said: Configuring IIS for Silverlight Applications : https://viralsarvaiya.wordpress.com/2010/09/09/configuring-iis-for-silverlight-applications/ […]

    Leave a Reply

    Fill in your details below or click an icon to log in:

    WordPress.com Logo

    You are commenting using your WordPress.com account. Log Out / Change )

    Twitter picture

    You are commenting using your Twitter account. Log Out / Change )

    Facebook photo

    You are commenting using your Facebook account. Log Out / Change )

    Google+ photo

    You are commenting using your Google+ account. Log Out / Change )

    Connecting to %s

     
    %d bloggers like this: