Sunday, July 4, 2010

HTTP Error 500.19 with IIS 7.0

Last week i was deploying an application in IIS 7.0 freshly configured and got a HTTP 500.19 error as elaborated below

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

Error Code: 0x80070021

Notification: BeginRequest

Module: IIS Web Core

Requested URL: http://localhost:4341/webapplication1

Physical Path: c:\inetpub\wwwroot\webapplication1

Logon User: Not yet determined

Logon Method: Not yet determined

Handler: Not yet determined

Config Error: This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false".

Config File: \\?\c:\inetpub\wwwroot\webapplication1 \web.config

 

This due to the web.config section is get locked. By default whenever we install ASP.NET this section will be get unlocked. But sometime if we install IIS after ASP.NET installation it will not get unlocked. Here is the appcmd to unlock the section

%windir%\system32\inetsrv\appcmd unlock config -section:system.webServer/handlers

You need to run this command in Administrator mode, also go to control panel-> Turn windows feature on or off and under IIS install ASP.net.