web.config allowDefinition=MachineToApplication error

Converting your folder/project into an application in IIS can resolved this error.


Create a virtual directory at the site root. This can be done via project properties in VS under the Web tab.

It's also possible that you have things defined in the sub-directory that should be in the root config file. See similar question here:

Error to use a section registered as allowDefinition='MachineToApplication' beyond application level


This error seems to occur if you try to open an asp.net WEBSITE and run it while it was originally encapsulated by a SOLUTION. Do this: Close the website, find the related solution (.sln-file) further up in the file system and open this in stead. Inside the solution you will now be able to use your website without getting this error.

It would be nice if Microsoft could guide people in the right direction when they get lost in asp.net like this. The present error message about allowDefinition=MachineToApplication is not understandable for normal humans like me.