migrating asp.net config to iis 7 integrated mode · 2013-04-24 · modifications. while iis 7...

12
MIGRATING ASP.NET CONFIG TO IIS 7 INTEGRATED MODE MD. SAIFULLAH AL AZAD, SOFTWARE ARCHITECT, LEADS CORPORATION

Upload: others

Post on 03-May-2020

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Migrating ASP.Net config to IIS 7 Integrated mode · 2013-04-24 · modifications. While IIS 7 provides the improved ASP.NET integration by default, there is a choice: IIS 7 supports

MIGRATING ASP.NET CONFIG TO IIS 7 INTEGRATED MODE

MD. SAIFULLAH AL AZAD, SOFTWARE ARCHITECT, LEADS CORPORATION

Page 2: Migrating ASP.Net config to IIS 7 Integrated mode · 2013-04-24 · modifications. While IIS 7 provides the improved ASP.NET integration by default, there is a choice: IIS 7 supports

TABLE OF CONTENTS

Contents

Introduction ______________________________________________________________________________________________ 1

Background _______________________________________________________________________________________________ 2

Solution ___________________________________________________________________________________________________ 3

Page 3: Migrating ASP.Net config to IIS 7 Integrated mode · 2013-04-24 · modifications. While IIS 7 provides the improved ASP.NET integration by default, there is a choice: IIS 7 supports

MIGRATION IIS

1 | P a g e www.dotnetbd.wordpress.com

Introduction

You have to face several configuration errors while migrating ASP.Net web application from IIS 6 to IIS 7.

One of the main and well known error which you will receive a 500 - Internal Server Error. This can

include HTTP Error 500.22, and HTTP Error 500.23: An ASP.NET setting has been detected that does not

apply in Integrated managed pipeline mode.

It occurs because ASP.NET modules and handlers should be specified in the IIS <handlers> and <modules>

configuration sections in integrated mode.

Page 4: Migrating ASP.Net config to IIS 7 Integrated mode · 2013-04-24 · modifications. While IIS 7 provides the improved ASP.NET integration by default, there is a choice: IIS 7 supports

MIGRATION IIS

2 | P a g e www.dotnetbd.wordpress.com

Background

Before moving forward towards solution of this problem, I would like to give you some background behind

the scene. For understanding the solution of this problem first we need to have some idea about IIS 7. IIS 7

increases ASP.NET power further by integrating the ASP.NET runtime extensibility model with the core

server. This allows ASP.Net developers to fully extend the IIS 7 server with the richness of ASP.NET 2.0 and

the .NET Framework. This integration enhances existing applications, and allows new applications to take

advantage of ASP.NET features. ASP.NET is configured on IIS 7 to operate in the new integrated mode by

default. This enables your application to take advantage of integrated mode enhancements with minimal

modifications. While IIS 7 provides the improved ASP.NET integration by default, there is a choice: IIS 7

supports both the new and the old ASP.NET integration modes that can be used side by side on the same

server. ASP.NET setup does provide an application pool named "Classic .NET AppPool" that runs in the

classic ASP.NET integration mode. You can use this application pool for applications that should not run in

integrated mode. On IIS 7, ASP.NET applications run in integrated mode by default. However, in order to take

advantage of the benefits provided by tighter integration, you must make some modification to application

configuration.

Page 5: Migrating ASP.Net config to IIS 7 Integrated mode · 2013-04-24 · modifications. While IIS 7 provides the improved ASP.NET integration by default, there is a choice: IIS 7 supports

MIGRATION IIS

3 | P a g e www.dotnetbd.wordpress.com

Solution

While migrating existing ASP.Net application from IIS 6 to IIS 7, because of the configuration unification, some applications may require migration in order to operate property in Integrated mode. IIS will automatically detect this configuration and issue an error asking you to migrate your application, or move it to classic mode if migration is not acceptable. ASP.NET applications require migration when specifying configuration in <httpModules> or <httpHandlers>. Otherwise following configuration causes the migration error:

1. The application web.config file defines <httpModules> configuration. The application loads new ASP.NET modules, or removes existing ones.

In Integrated mode, ASP.NET modules are specified together with native modules in the unified <system.webServer>/<modules> configuration section. The ASP.NET modules specified in the <system.web>/<httpModules> configuration section must be moved to the new configuration section in order to take effect. Subsequently, new ASP.NET modules must be added directly to the unified <modules> section. 2. The application web.config file defines <httpHandlers> configuration. The application uses custom handler mappings for some content types. In Integrated mode, the ASP.NET handler mappings must be specified in the unified

<system.webServer>/<handlers> configuration section in order to take effect. Subsequently, new ASP.NET handler mappings must be added directly to the unified <handlers> section. The section replaces both the ASP.NET <httpHandlers> configuration AND the IIS 7 scriptmaps configuration, both of which previously had to be configured in order to set up an ASP.NET handler mapping.

You must migrate the application configuration to work properly in Integrated mode. IIS 7 takes care of migrating the application by using the APPCMD.EXE command line tool to perform the migration.

You can also migrate manually by moving the custom entries in the <system.web>/<httpModules> and <system.web>/<httpHandlers> configuration manually to the <system.webServer>/<handlers> and <system.webServer>/<modules> configuration sections, and either removing the <httpHandlers> and <httpModules> configuration OR adding the following to your application’s web.config:

<system.webServer>

<validation validateIntegratedModeConfiguration="false" />

</system.webServer>

For running the command line tool, right click the Programs\Accessories\Command Prompt icon, and

choose "Run as administrator") in order to instantly migrate your application to Integrated mode.

Page 6: Migrating ASP.Net config to IIS 7 Integrated mode · 2013-04-24 · modifications. While IIS 7 provides the improved ASP.NET integration by default, there is a choice: IIS 7 supports

MIGRATION IIS

4 | P a g e www.dotnetbd.wordpress.com

The basic format of the migration command is the following:

%windir%\system32\inetsrv\APPCMD.EXE migrate config

Where <Application Path> is the virtual path of the application containing the site name, such as

"localhost/samplewebsite".

Page 7: Migrating ASP.Net config to IIS 7 Integrated mode · 2013-04-24 · modifications. While IIS 7 provides the improved ASP.NET integration by default, there is a choice: IIS 7 supports

MIGRATION IIS

5 | P a g e www.dotnetbd.wordpress.com

If the above error occurs then you need to give some permissions to the web application to which you want to migrate. Open the IIS 7 and select the application.

Page 8: Migrating ASP.Net config to IIS 7 Integrated mode · 2013-04-24 · modifications. While IIS 7 provides the improved ASP.NET integration by default, there is a choice: IIS 7 supports

MIGRATION IIS

6 | P a g e www.dotnetbd.wordpress.com

After clicking a popup will appear. Click on Security Tab.

Page 9: Migrating ASP.Net config to IIS 7 Integrated mode · 2013-04-24 · modifications. While IIS 7 provides the improved ASP.NET integration by default, there is a choice: IIS 7 supports

MIGRATION IIS

7 | P a g e www.dotnetbd.wordpress.com

Click on Edit button to edit the permissions.

Page 10: Migrating ASP.Net config to IIS 7 Integrated mode · 2013-04-24 · modifications. While IIS 7 provides the improved ASP.NET integration by default, there is a choice: IIS 7 supports

MIGRATION IIS

8 | P a g e www.dotnetbd.wordpress.com

Click on Add.. button to add ASPNET account.

Page 11: Migrating ASP.Net config to IIS 7 Integrated mode · 2013-04-24 · modifications. While IIS 7 provides the improved ASP.NET integration by default, there is a choice: IIS 7 supports

MIGRATION IIS

9 | P a g e www.dotnetbd.wordpress.com

Click on OK and Allow the Full control and click on OK

Now run the tool again.

Page 12: Migrating ASP.Net config to IIS 7 Integrated mode · 2013-04-24 · modifications. While IIS 7 provides the improved ASP.NET integration by default, there is a choice: IIS 7 supports

MIGRATION IIS

10 | P a g e www.dotnetbd.wordpress.com

When migration is complete, your application runs in both Integrated and Classic modes without a problem.