Wednesday, 9 June 2010

ASP.Net allowDefinition='MachineToApplication' Error

I've come across this problem a number of times now and it was beginning to annoy me. A few times when building projects on continuous integration servers and today when upgrading my MVC web app to MVC 2 I hit the following 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.

Everytime I failed to figure out what the problem was and instead I had to admit defeat and use a work-around :(

Well the error message is quite helpful for some people getting this error at runtime and tells them how to fix the problem - configure the web apps virtual directory to be an application. However, I'd been stumbling upon this delightful error when compiling projects - not at runtime!

Luckily I had a light bulb moment... the compiler was not referring to my main web.config for the application, but instead was moaning about a web.config within a sub directory of my application (a backup of the project). Deleting the backup sub directory solved my problems!

I got 99 problems but my web.config ain't one!

3 comments:

Joshua Smith said...

Hey! thanks for useful review. It was easy to read, but I'd like to add that if your business needs to be updated try outsource software development.

Joshua Smith said...

Thank you for sharing with us. Many poker affiliates look for lastest fresh affiliate programs at such comparison online gambling websites.

Joshua Smith said...

Thanks for nice article. Let me mention about home insurance rates for USA policy owners home insurance companies. Save on free online rates on homeowners insurance.

Post a Comment