Issue - allowDefinition = MachineToApplication beyond application level
 
Author:
Filed Under: ASP.Net  |  Issues and Exceptions
Published Date: Aug 07, 2011
Views: 1316
 

Abstract: In this article Mudassar Ahmed Khan has explained the issue allowDefinition='MachineToApplication' beyond application level which occurs when you run your Website application or project in Visual Studio, its cause and solution.

Comments:  0

 

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.                 

 

Cause

One encounters this error while running a WebSite project. This error is encountered when one selects the parent folder of a website project instead of the Website itself in the Website Browser.

 The reason is for a project to ASP.Net run it needs Web.Config which is inside the Website folder and not its parent and since you selected parent folder it throws the above error.

As you can see in the figure below I am selecting the parent folder of the Website and not my website



Selecting parent folder instead of Actual WebSite

And when I try to run it I get the above error. Refer figure below.



allowDefinition='MachineToApplication' beyond application level Error

Solution

There are two solutions

1. Cut and paste the Web.Config in the from the WebSite folder to the parent folder

2. Recommended Solution: Select the Website itself rather than its parent folder in the WebSite Browser.

 

In the figure below, I am now selecting WebSite itself and not its parent



Selection of Actual Website and not parent solves the issue

A thumb rule to avoid this error check if your Website’s Root folder has Web.Config or Not









Related Articles



Comments

No comments have been added to this article.

Add comments

You can add your comment about this article using the form below. Make sure you provide a valid email address
else you won't be notified when the author replies to your comment

Please note that all comments are moderated and will be deleted if they are
  • Not relavant to the article
  • Spam
  • Advertising campaigns or links to other sites
  • Abusive content.
Please do not post code, scripts or snippets.

Name*: Required
Email*: Required
Comment*: Required
Security code*: CaptchaInvalid Security Code
  Submit