I was trying to deploy my Project using Visual Studio 2008 a while ago, when I encountered this 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.”

And I had no idea why it was happening. I was not even trying to access my project in a browser (I was just trying to deploy!). I wasted almost an hour trying to figure it out before I luckily stumbled to Rob Gruen’s blog. Though his case was different (I did not upgrade), I hurriedly followed his suggestion. I search for web.config file in my project’s folder and to my surprise, there were two of them. Suddenly, I remember that I was testing something and added a test-website inside my project which contains a web.config file. I just deleted the whole test-website and, boom! the deployment went smoothly. So, if you encounter this error, just remember that you cannot use multiple web.config in one application.

Tags: