如何解决"/'应用程序中的服务器错误"错误?

pri*_*kar 23 asp.net

我正在尝试在我们的服务器中部署asp.net应用程序,而我收到以下错误.

Server Error in '/' Application. 
________________________________________
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 63:             ASP.NET to identify an incoming user. 
Line 64:         -->
Line 65:                  <authentication  mode="Windows"/>
Line 66:                  <!--<forms loginUrl="~/SCR.UI/Login1.aspx"/>
Line 67:                  </authentication>-->
Source File: D:\BarclaysPayamentManagementSystem\scr.ui\web.config    Line: 65
Run Code Online (Sandbox Code Playgroud)

是什么原因以及如何解决?

请帮忙


Árv*_*gép 17

尝试浏览asp.net应用程序时可能会出现此错误.

调试信息显示"此错误可能是由于未在IIS中将应用程序配置为虚拟目录引起的."

但是,此错误主要发生在2个方案中.

  1. 使用visual studio.net创建新的Web应用程序时,它会自动创建虚拟目录并将其配置为应用程序.但是,如果您手动创建虚拟目录并且未将其配置为应用程序,则您将无法浏览该应用程序并可能会收到上述错误.您如上所述获得的调试信息适用于此方案.

要解决此问题,请右键单击虚拟目录 - 选择属性,然后单击"应用程序"标签和文本框旁边的"创建".它将使用虚拟目录的名称自动创建"应用程序".现在可以访问该应用程序.

  1. 如果应用程序中有子目录,则可以为子目录提供web.config文件.但是,有些属性无法在子目录的web.config中设置,例如身份验证,会话状态(您可能会看到错误消息显示在web.config中声明身份验证或会话状态的行号)子目录).原因是,除非子目录也配置为应用程序(如上所述),否则不能在子目录级别覆盖这些设置.

如果我们想要保护对子目录文件的访问(例如,目录是admin并且我们希望保护管理页面免受非协作用户的访问),我们通常会在子目录中添加web.config.

  • 请注意@Moayad Mardini给出了你复制答案的链接 - 至少通过投票给他的答案给了他们信用...... (7认同)

Dro*_*ror 5

当.NET版本出错时,我遇到了这个错误 - 请确保将站点配置为您需要的站点.

有关详细信息,请参阅aspnet_regiis.exe.


moh*_*has 5

我在VS 2015中遇到此错误,在我的情况下转到项目属性页面,Web选项卡,然后单击Create Virtual DirectoryServers部分中的按钮解决了它