简体   繁体   中英

Upgrade asp.net 3.5/IIS6 application to asp.net 4.0/IIS7.5

I am migrating a web application (WebForms) from ASP.NET 3.5 on IIS6 to ASP.NET 4.0 on IIS 7.5.

I created a new project in VS2010 and add the existing source files from the old project and compiled. It took a small amount of tweaking but everything compiled fine.

When I run the application via IIS (http://localhost/myapp) I get the following error:

HTTP Error 500.19 - Internal Server Error

The requested page cannot be accessed because the related configuration data for the page is invalid.

The relevant part of the Web.config is:

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

...

The error is highlighting the script ResourceHandler

I have done some Googling but cannot find a solution to this problem. Any ideas?

The first thing that pops out at me is that the ScriptResourceHandler block, as well as the others that you've listed, are referencing v3.5 of System.Web.Extensions, where it should be referencing v4 for a .NET 4 application.

(Not all of the .NET 4 framework assemblies have been updated to a v4 version number but this one does.)

It looks like you're working with the the old v3.5 web.config. If so, you may try making a backup of web.config (of course), adding a new, default web.config to the web app, and then adding in any custom settings ( appSettings , connectionStrings , etc). That's probably the fastest way to get a correct web.config without having to manually modify each entry, update attribute names, etc.

Also, you may or may not be aware that many IIS settings have been moved into the system.webServer section in web.config in 7.x that were in other sections for IIS6/v3.5. If you start with VS's default v4 web.config, it won't be an issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM