Karine Bosch’s Blog

On SharePoint

Configure your SharePoint Server for Silverlight 2


Integrating Silverlight in SharePoint is a hot topic these days. Silverlight can be useful in various scenarios. But the most difficult part is the configuration of your SharePoint server. This article explains what should be installed on the server and which post-installation actions to take after installation.

Installation

If you also want to develop your own Silveright applications using Visual Studio 2008 on this machine, you have to download and install:

 

Configuration

Global Assembly Cache

 SharePoint needs the System.Web.Silverlight.dll to be available in the Global Assembly Cache. This dll is part of the Silverlight 2 SDK and is located in the c:\Program Files\Microsoft SDKs\Silverlight\v2.0\Libraries\Server directory.

 There are 2 ways to drop a dll in the GAC:

  1. Open a Windows Explorer and navigate to C:\Program Files\Microsoft SDKs\Silverlight\v2.0\Libraries\Server directory. Open a second Windows Explorer and navigate to the C:\Windows\assembly directory. Drag the System.Web.Silverlight.dll from the first Windows Explorer into the second one.
  2. Open a command prompt and execute the following: GACUTIL /if “C:\Program Files\Microsoft SDKs\Silverlight\v2.0\Libraries\Server\System.Web.Silverlight.dll”.

web.config

If you have Visual Studio 2008 installed, the best way to proceed is:

 1. Open Visual Studio 2008 and create an ASP.NET web site with the .NET Framework 2.0

 website2

2. In Windows Explorer navigate to the folder where the web.config of your SharePoint web application is located, usually somewhere in the C:\inetpub\wwwroot\wss\VirtualDirectories directory.

3. Make a backup copy of the web.config.

4. Open the web.config and copy the content.

5. In Visual Studio 2008, replace the content of the web.config of the newly created ASP.NET web application.

5. Right-click the web site project in Solution Explorer and choose Property Pages.

6. Choose the Build option.

 target-framework

7. In the Target Framework section choose .NET Framework 3.5.

8. Click the OK button. This will upgrade your web.config for use with the .NET Framework 3.5. 

 9. Now your web.config is only configured for AJAX support. Scroll down to the <system.web><compilation><assemblies> section and add the following (on one line):

<add assembly="System.Web.Silverlight, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

10. Scroll down to the <system.web><pages><controls> section and add a tag prefix for the Silverilght control. This is necessary if you want to host Silverlight on application pages:

<add tagPrefix="asp" namespace="System.Web.UI.SilverlightControls" assembly="System.Web.Silverlight, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

11. Save your changes.

If you don’t have Visual Studio 2008 installed, you have to add following sections to the web.config:

1. Open Windows Explorer and navigate to the folder where the web.config of your SharePoint web application is located, usually somewhere in the C:inetpubwwwrootwssVirtualDirectories directory.

2. Make a backup copy of your web.config file.

3. Open the web.config file.

4. To the <configuration><configSections> node add:

  <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
     <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
        <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
        <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
            <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
            <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
            <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
            <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
        </sectionGroup>
     </sectionGroup>
  </sectionGroup>

5. To the <system.web><compilation><assemblies> node add:

  <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
  <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
  <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
  <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
  <add assembly="System.Web.Silverlight, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

6. To the <system.web><pages><controls> node add:

   <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
   <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
   <add tagPrefix='asp' namespace="System.Web.UI.SilverlightControls" assembly="System.Web.Silverlight, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> 

7. To the <system.web><httpHandlers> node add:

  <remove verb="*" path="*.asmx"/>
  <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
  <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
  <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/> 

8. To the <system.web><httpModules> node add:

  <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>


9. If you run ISS7 add the following section to the <configuration> node. This seems not to be necessary if running a previous version of IIS:

  <system.webServer>
     <validation validateIntegratedModeConfiguration="false"/>
     <modules>
        <remove name="ScriptModule" />
        <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
     </modules>
     <handlers>
        <remove name="WebServiceHandlerFactory-Integrated"/>
        <remove name="ScriptHandlerFactory" />
        <remove name="ScriptHandlerFactoryAppServices" />
        <remove name="ScriptResource" />
        <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode"
             type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode"
             type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
     </handlers>
  </system.webServer>

10. Add an AssemblyBinding element to the <configuration><runtime> node:

   <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
          <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
          <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
          <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
          <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
      </dependentAssembly>
   </assemblyBinding>

mime type

If you work with IIS 7 the mime type for Silverlight 2 applications is already configured. If not you have to define the mime type yourself for each SharePoint web application or at the root of IIS if you want all your web applications to know the Silverilght mime type:

  • Open Internet Information Services
  • Right-click the SharePoint web application or the Sites root
  • Choose Properties
  • Activate the HTTP Headers tab
  • Click the MIME types button
  • Click the New button in the MIME types dialog
  • Define a new MIME type by setting the Extension to .xap and the MIME type to application/x-silverlight.
  • Click the several OK and Apply buttons to save your changes.

 mimetype

6 Comments »

  1. hey,

    Just the blog that I was looking for🙂 hope all is well karine.

    greetings
    andy

    Comment by Andy Van Steenbergen | March 30, 2009 | Reply

  2. My fellow on Facebook shared this link and I’m not dissapointed that I came to your blog.

    Comment by Ex Girlfiend | April 10, 2009 | Reply

  3. Thank you for your help!!!!!

    Comment by Alexander | July 2, 2009 | Reply

  4. Hey there..

    Thanks for an excellent walkthru. We were struggling for a couple of days and your instructions were just the thing we needed.

    thanks again.

    -amit

    Comment by Amit | March 25, 2010 | Reply

  5. Bravo!!

    Eres grande!!!

    Comment by franciscoarmando | August 27, 2010 | Reply

  6. Thanks ,

    I spent long time to search this information . And got finally here .

    Thanks again

    Comment by training Indore | November 25, 2010 | Reply


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: