Arturito.net

Come to The Dark Side, We Have Cookies!

ASP.MVC 2 – How to migrate project from ASP.NET 2.0 .NET Framework 3.5 to ASP.NET 4.0 .NET Framework 4

without comments

So you have decided to move your ASP.NET MVC2 project  from the Windows Server configured with  ASP.NET 2.0 .NET Framework 3.5
to  ASP.NET 4.0 .NET Framework 4.

Here is how I did it.

My old setup:

Windows Server 2008 R2
IIS 7.5
ASP.NET
Application Pool : .NET Framework v2.0.50727
.NET Framework installed:  3.5 SP1

My new setup:

Windows Server 2008 R2
IIS 7.5
ASP.NET
Application Pool : .NET Framework v4.0.30319
.NET Framework installed:  4.0

The good thing is that the ASP.NET is backward compatible. You shoud publish the website on the new setup and it should work straight away.

In my case I had to remove these from web.config:


<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirepermission="false" allowdefinition="MachineToApplication"></section>
<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><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><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><section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirepermission="false" allowdefinition="MachineToApplication"></section>

If it still gives you problems got to IIS Manager and click Error Pages:

Select 500 , right click and select Edit Feature Settings

Here select “Detailed errors”

Now you should get detailed error within your web.config. Also check Event Viewer under the section Administrative Events

Written by arturito

January 25th, 2012 at 10:20 am