Fixing allowDefinition='MachineToApplication' Errors

Posted in Tutorials

Error: 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.

This error is generally caused by a web.config in a subdirectory trying to overwrite the root web.config's authentication or authorization tags. It may also occur using location tags or when creating Virtual Apps as part of an existing ASP.NET application. The proper fix is to sort out what configuration is causing the issue. If that isn't an option here is a quick cheat to help you on your way.

Open

C:\Windows Folder\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config
(change the sections in italics for your operating system and .NET version.) Then change the following line

to

It's cheating but it works.