Learning While Aging

It is an error to use a section registered as allowDefinition=’MachineToApplication’ beyond application level

When launching a web application, an error like this shows up:

It is an error to use a section registered as allowDefinition=’MachineToApplication’ beyond application level.  This error can be caused by a virtual directory not being configured as an application in IIS.

There are several causes for this error:

1. Just like the error says, the virtual directory in IIS is not an application folder. To fix, just go to IIS and expand “Default Website” folder, right-click on the virtual directory and select “Properties”. If the “Application Name” field is grayed out, then just click “Create” button then click OK to exit. This will fix the error.

2. If you use Visual Studio 2005 to upgrade your application and click Yes when prompted for backing up the current application, then after the upgrade you will get this error when you try to run the application. Because Visual Studio 2005 will create a backup folder within the application with your old application in it, but this backup folder is not configured as an application folder, as a result, the error pops up. To fix this, just move the backup folder outside of the project.

3. You have multiple web.config files in your project.

The common use of mutiple web.config files is to protect the access to some folders. However, there are some sections cannot be used in the subdirectory web.config unless the subdirectory is configured as an application folder. Those sections include <authentication>, <machineKey>, <membership>, <sessionState>. A complete list of the sections are defined with the <section> tag in the machine.config file, and the <section> has an attribute called allowDefinition. For this particular error, check those <section> tags with allowDefinition=”MachineToApplication”.

To fix this error in this scenario, just remove those disallowed sections from the subdirectory web.config, or configure the subdirectory as an application directory in IIS if you need those sections.

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x