Virtual Directory not being configured as an application in IIS

I downloaded a testing website code from a site and I converted it to visual studio 2008. But, I get the compilation error as follows:

“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.”

Anyone, solve the problem plz??!!

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

It depends how your are running the application.

If your running it thro the temp asp.net webserver which starts when you run any application from the VS2008

or

Configure the web apps in your system IIS.

You might be getting this error because, the application need to configure in the local IIS
instead of temp. asp.net web server. So move the application files into the Inetpub/wwwroot folder. And configure it as the web application before running.

Ref.

http://forums.asp.net/t/1031775.aspx <<– try this one first

http://umbraco.org/documentation/books/install-umbraco-4-on-windows-vista/configure-iis-website

http://www.shabdar.org/virtual-directory-not-being-configured-as-an-application-in-iis.html

Method 2

This problem most commonly arises when you open the website in Visual Studio but accidentally open the parent of the root folder. For example, imagine that you have a website located at C:MyProjectsWebsite1, where the Website1 folder is the root of the website. When you open this website from Visual Studio you are asked to specify the website’s root folder – it is imperative that choose the Website1 folder. If you accidentally select the MyProjects folder then the Web.config file in the Website1 folder is now in one of the website’s subfolders. Because that Web.config file includes the element, among other application-level settings, you’ll receive the above error.

The fix to this error (in most cases), then, is to close your project and reopen it from Visual Studio, making sure that you select the appropriate folder.

Happy Programming!

Reference: http://scottonwriting.net/sowblog/archive/2010/02/17/163375.aspx

Method 3

If you got this error when using IIS, try Add Application rather than Add Virtual Directory.

Reference to this answer.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x