Solution-error can be caused by a virtual directory not being configured as an application in IIS”

{0 Comments}

 Here I am with the an error mostly seen in asp.net application running on the IIS server the exact error is

β€œ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.”

When you create an asp.net application on visual studio and it simultaneously create a virtual directory and consider it as an application. And if you do the same manually then there are greater chances of getting above error while debugging.

  And other main cause is to have our application on the sub-directory level and its web-config file is at the same level. The main problem at this scenario is that some of the authentication can not be done at the same level. so at the sub directory level you have do following changes to your application.

 XML |  copy code |? 
1
<configuration>
2
<system.web>
3
<authorization>
4
<allow roles="administrators" />
5
<deny users="*" />
6
</authorization>
7
</system.web>
8
</configuration>
9

And if you wish to change in  your root web.config file then you can do following changes to file.

 XML |  copy code |? 
1
<location path="Admin">
2
<system.web>
3
<authorization>
4
<allow roles="administrators" />
5
<deny users="*" />
6
</authorization>
7
</system.web>
8
</location>

This error comes when application or programmer crosses the line toward server admin. And you have to create an IIS application on your server for a particular app or website. For this all you have to convert your existed app or website folder to asp.net application to resolve this problem.  

And if you have moved your application and still getting this problem then try to restart your IIS server to solve this problem.

Leave a Comment

Your email address will not be published.