If you’re new to IIS 7 (you probably are) you might receive this nice little gem when you first start working with it:
HTTP Error 500.19 – Internal Server Error
Description: The requested page cannot be accessed because the related configuration data for the page is invalid.
Error Code: 0x80070021
Module: IIS Web Core
Requested URL: http://localhost:80/ExampleApplication/
Physical Path: C:\inetpub\wwwroot\ExampleApplication\
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\ExampleApplication\web.config
186: <remove name="WebServiceHandlerFactory-Integrated"/>
184: </modules> 185: <handlers> 186: <remove name="WebServiceHandlerFactory-Integrated"/>
IIS 7 implements “Configuration Locking“. This is to help with IIS administration. The IIS Administrator can lock down Configuration Sections, Section Elements and Attributes at the IIS level. This allows the administrator to have a more granular level of control on the system. Read this link to see more about it.
Important Note: In order make these changes, you must be an administrator on the machine where the config file resides. If its on your local machine, you must be an administrator on your machine.
Since I’m on my own development machine, and since this is a development machine, I have decided to change the global setting (the config section itselft). To fix this error I had to go to the applicaitonHost.config file and set the overrideModeDefault to “Allow”.
Open the applicationHost.config file, located here: %windir%\system32\inetsrv\config\applicationHost.config
In my instance, I need to edit the “handlers” section.
Change this line:
<section name=”handlers” overrideModeDefault=”Deny” />
<section name=”handlers” overrideModeDefault=”Allow” />
Thats it. 🙂
You might receive more errors after you enable this, such as the same error for modules, but just follow the same steps above, and you should be good.
Note: You can accomplish this same thing through the command line by using the appcmd.exe application (%windir%\system32\inetsrv\appcmd.exe). Like this:
%windir%\system32\inetsrv\appcmd unlock config -section:system.webServer/handlers
One more note…
This is not something you’d want to do on a production server unless you’re sure you want to enable all appliations to override the section contents. Be sure to read up on some of the docs (explanation of the configuration system) before you make this change on production.