How to solve Server Error in ‘/’ Application.

asp.netiisweb-applications

I have been trying to access my partner's web application from my computer but this problem keeps showing up.I have tried to convert the web application to an application in IIS,but the problem still persists.

Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: 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.

Source Error:

Line 17:                <add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
Line 18:                <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies></compilation>
Line 19:        <authentication mode="Forms">
Line 20:            <forms loginUrl="~/Account/Login.aspx" timeout="2880"/>
Line 21:        </authentication>

Source File: C:\inetpub\wwwroot\fas\fas\web.config Line: 19

Show Additional Configuration Errors:

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. (C:\inetpub\wwwroot\fas\fas\web.config line 22)
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. (C:\inetpub\wwwroot\fas\fas\web.config line 28)
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. (C:\inetpub\wwwroot\fas\fas\web.config line 34)

Best Answer

The problem happens because you have another web.config file in a sub directory of the application, and it has the authentication element. The authentication element can only appear in the root web.config. Please refer to the element documentation here. Under the Element Information section it's stated that the Configurable locations are Machine.config, Root-level Web.config, Application-level Web.config

To solve the problem, you have to do either:

  • Remover the child web.config, and leave just the one on the root.
  • Or, if the child web.config is essential to your application, remove the whole authentication element from it. You may configure your authentication only once in the root level web.config.