Monday, October 13, 2008

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

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

This error popped up for me when I had accidentally added some websites below my main website. This is caused by settings in the web.config's of lower subdirectories having settings that can only be on the main config's file. Settings of this type include authentication, session state.

I have heard rumor that you can leave those there by marking the folder in the following way, but I have not needed it so I cannot be sure:

Right Click on the virtual directory - select properties and then click on
"Create" next to the "Application" Label and the textbox. It will automatically create the "application" using the virtual directory's name. Now the application can be accessed.

Hopefully this is helpful to others who get an extra web.config in their subdirectories though.

No comments: