Spurious MachineToApplication Error With VS2010 Deployment

Often when I'm building my MVC 2 application using Visual Studio 2010, I get 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.

On the internet, this error seems to be related to having a nested web.config in your application. I do have such a thing, but it's just the one that came out of the MVC 2 project item template and I haven't touched it.

In my case, this error in my case doesn't seem to have anything to do with a nested web.config. This error only started to happen when I began using the web site deployment features in VS2010 which by itself, rocks (see Scott Hanselman's "Web Deployment Made Awesome: If You're Using XCopy, You're Doing It Wrong" for details).

 If it happens to you and it doesn't seem to make any sense, you can try to fix it with a Build Clean command. If you're using to previous versions of Visual Studio, you'll be surprised, like I was, not to find a Clean option in sparse the Build menu. Instead, you can only get to it by right-clicking on your project in the Solution Explorer and choosing Clean.

Doing that, however, seems to make the error go away. I don't think that's a problem with my app; I think that's a problem with VS2010.



Comment Feed 6 comments on this post

Eduardo:


OMG. I'm having this *exact* problem, and I was about to post it to Stack Overflow after the morning web surfing.

Monday, May 24, 2010, 5:47 AM


Chris Sells:


Well I try to be timely. : )

Monday, May 24, 2010, 6:45 AM


Eduardo:


I've found that if I removed <MvcBuildViews>false</MvcBuildViews> everything is back to normal again

Monday, May 24, 2010, 8:18 AM


Kazi Manzur Rashid:


Try remove the obj folder and the publish.xml from the web project and you are good to go.

Monday, May 24, 2010, 5:02 PM


Eduardo:


haven't found anything about it? Can't you use your MS powers?

Wednesday, Jun 9, 2010, 2:21 PM


Dan:


I have been dealing with this too. There's a question on StackOverflow at the moment on it
http://stackoverflow.com/questions/2566215/allowdefinitionmachinetoapplication-error-when-publishing-from-vs2010-but-onl

It's caused by some weird thing to do with buidling of the deployment and the web.config that gets put into the OBJ folder. So set the "BaseIntermediateOutputPath" folder to a place outside of your project.

You have to add a line to the project.
<BaseIntermediateOutputPath>[SomeKnownLocationIHaveAccessTo]</BaseIntermediateOutputPath>

Monday, Jun 21, 2010, 5:39 AM





comment on this post

HTML tags will be escaped.

Powered By ASP.NET

Hosted by SecureWebs

Microsoft

Mensa

IEEE


moving companies
addiction treatment
sunglasses
Kratom
How To Lose Weight Fast
cocktail dresses
Credit Card Balance Transfer
Add URL
Stock Trading
Health Insurance Quotes
Promotional Merchandise
Jet Privé
loans for bad credit