You are probably saying, "Whaaaaaat???" after reading my last post. There are quite a number of configuration changes and components to install to get Silverlight up and running in your SharePoint environment. Here's an alternative. I've put together a SharePoint solution which will make all the necessary web.config changes for you. That's right! Just install this solution, activate the feature on the web application you want to wreck (Silverlight'ify) and presto.
Please don't forget that you need to have the following installed on your server for Silverlight to work:
- SharePoint SP1 (don't forget wss sp1 and office server sp1 both need to be installed)
- The Silverlight plugin
- Silverlight 2 Beta 1 SDK
- System.Web.Silverlight.dll in the GAC (not sure why the SDK install doesn't do this automagically when you choose to install the server components)
Here's the link to the solution file:
IWWebConfigSolution
IMPORTANT
Don't forget to register the MIME type for the .xap extension or you'll be scratching your head looking at a blank screen.
Bug Found
Unfortunately, this solution has a small bug. In the httpHandlers section the following line gets added at the end of the section, and it needs to appear before the other added entries.
<remove verb="*" path="*.asmx"/>
I have not found a way around this issue. So, after the solution deployment, this entry will need to be moved by hand.
For those of you would-be SharePoint developers who want to dabble with Silverlight, here's a post that describes how to get your environment up and running.
First, check out this great blog post I found. This will cover the steps that you need to do to get things working.
http://www.u2u.info/Blogs/Patrick/Lists/Posts/Post.aspx?ID=1794
If you don't want to spend an hour or two comparing web.config files, I will detail what needs to be changed and where.
Find the <configSections> group under <configuration> and add the following before the closing </configSections> tag.
1: <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
2: <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
3: <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
4: <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
5: <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
6: <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
7: <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
8: <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
9: </sectionGroup>
10: </sectionGroup>
11: </sectionGroup>
Next, find the <SafeControls> section under <configuration><SharePoint> and add the following safe control entry.
1: <SafeControl Assembly="System.Web.Silverlight, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" Namespace="System.Web.UI.SilverlightControls" TypeName="*" Safe="True" />
Then, add the following section to the <configuration><system.web><httpHandlers> section immediately before the closing </httpHandlers> tag.
1: <remove verb="*" path="*.asmx" />
2: <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
3: <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" />
4: <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" />
Add this next entry to the <httpModules> section under <configuration><system.web>.
1: <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
In the <configuration><system.web><compilation><assemblies> section, add these entries.
1: <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
2: <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
3: <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
4: <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
5: <add assembly="System.Web.Silverlight, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
Now, add these entries to the <configuration><system.web><pages><controls> group.
1: <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
2: <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
Finally, to the <configuration><runtime> section add the following to the <assemblyBinding> group before any other <dependencyAssembly> entries.
1: <dependentAssembly>
2: <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35" />
3: <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0" />
4: </dependentAssembly>
5: <dependentAssembly>
6: <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35" />
7: <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0" />
8: </dependentAssembly>
There are some additional configuration changes that will need to be made if you are using Windows Server 2008 or IIS 7. My test environment is running Windows Server 2003 with IIS 6 and therefore does not require them. Creating a new Silverlight web project in Visual Studio will create a web.config file with the required entries for IIS 6 and IIS 7.
IMPORTANT FINAL STEP
Please pay special attention to step 7 in the referenced blog post above. This step is critical and your Silverlight apps will not work unless you register this MIME type correctly.