Albert Jan Schot
 

Updating your web.config from .net 2.0 to 3.5

21

Sep

Whenever I make a new SharePoint web application trough the Central Admin, the next thing I do is beating myself up for the fact that it’s a .net 2.0 version, and since we use .net 3.5 stuff in most of the projects we do, we always have to ‘upgrade’.

Now there are two ways of doing that, either edit the web.config manually. Or copying it in a ‘blank’ site project in Visual Studio, and then changing the .net version in the project settings.

*Update 21-09-09:
My colleague Vishal pointed me to http://ajaxifymoss.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=13360 that is actually a very nifty tool saving you lots of time updating your web.config! So whenever you have the rights to use install this tool I suggest you use that, instead of doing it manually.

However, when you find someone else mad a .net 2.0 web.config on a production environment and you don’t have a Visual Studio present the following might come in handy.

The following lines are the lines that have to be added to your web.config in order to upgrade it to version 3.5. So just make a backup copy of your existing web.config, and open the original in notepad. (Make sure that whenever you run it on a Windows 2008 Server, you run your notepad instance as an Administrator in order to be able to safe your work).

Add this to the configSections

<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>

Add the following statement to the HttpHandlers

<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" validate="false" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

Add the following statement to the HttpModules

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

Add the following statement to the Assemblies

<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.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

Add the following statement below the tagMapping

<controls>

      <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"/>

</controls>

Add the following statement to the Assemblybinding - runtime

<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>

Add the following statement below the system.net

  <system.codedom>

    <compilers>

      <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">

        <providerOption name="CompilerVersion" value="v3.5"/>

        <providerOption name="WarnAsError" value="false"/>

      </compiler>

    </compilers>

  </system.codedom>

  <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" verb="GET,HEAD" path="ScriptResource.axd" preCondition="integratedMode" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

    </handlers>

  </system.webServer>

After this you’re done and can safe the web.config, and re-open your site, while being able using the .net 3.5 stuff you need.

Albert-Jan Schot schreef

Comments (1)

Albert-Jan Schot

Failed to extract the cab file in the solution

10

Sep

So, failed, now that explains a lot. I while ago i had this error and it got me looking almost everywhere trying to find a solution. Posts about invalid characters in the manifest.xml didn’t provide me a solution since i had no special characters anywhere. However they got me in the right direction, the encoding of the manifest.xml should be UTF-8, and for some reason I found out it wasn’t.

So whenever you have the error “failed to extract the cab file in the solution”, do three things

    • make sure you don't have any special characters in your manifest.xml (or any other solution file).
    • check the encoding and make sure it’s set to UTF-8.
    • according to this post the error can be provoked by having two files with the same name in either the feature.xml, the elementmanifest.xml or the solution.ddf

You can easily check the encoding by opening the file in your notepad.exe and then do a save-as. It will have a property Encoding that should be UTF-8:

image

Then of course rebuild your .wsp, and deploy it again.

Albert-Jan Schot schreef

Comments (0)

Albert-Jan Schot

SearchFacets WebPart Object reference

08

Sep

Today I found myself stuck with a server having the FacetedSearch v 3.0 installed on it, along with the v 2.5, and as expected it has some conflicts, and after an hour trying to fix it, I decided to reinstall everything.

A few minutes later I had a clean install of v 2.5, and it seems to works fine, except for the SearchFacets WebPart kept giving me an object reference not set to an instance of an object. After beating myself for another 30 minutes I realized that the WebPart properties where all blank. So after changing them (important one is the one about the scope, it has to be valid), it all worked fine.

So after some testing, it seems that whenever you have the .webpart files already in your library they got replaced, but without any default settings in it. And that's something that is nice to know, and can save you quite some time.

Albert-Jan Schot schreef

Comments (0)

Albert-Jan Schot

Slow IE 8 & Publishing Sites

01

Sep

Today i stumbled upon a nice post about one of the things I feel irritated about almost every day. It is in Dutch and can be found here.

For the none Dutchies a short recap;

Whenever you refresh a page that is checked out, or in edit mode IE gets extremely slow, it almost feels like it crashes. So according to the post above you can easily fix that by unchecking the Native XML property:

image

Albert-Jan Schot schreef

Comments (0)

Albert-Jan Schot