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 59: ASP.NET to identify an incoming user.
Line 60: -->
Line 61: <authentication mode="Forms">
Line 62: <forms loginUrl="Login.aspx" name=".ASPXAUTH" defaultUrl="Login.aspx" protection="All" path="/"></forms>
Line 63: </authentication>
Source File: D:\Etool Project\ERecruitmentfinal2\WebClient\web.config Line: 61
Show Additional Configuration Errors: D:\Etool Project\ERecruitmentfinal2\WebClient\web.config
这是我在将 iis 中的文件配置为虚拟目录时遇到的错误。我尝试在 iis 中配置虚拟目录并启用表单身份验证,但它也显示错误:不允许在应用程序下方设置配置部分
我的 web.config 文件是
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appSettings>
<add key="smtpcon" value="smtp.gmail.com"></add>
<add key="USERNAME" value="radiantsofthrms@gmail.com"></add>
<add key="PASSWORD" value="Hrms123$"></add>
<add key="LogAudit" value="true"></add>
<add key="PhotoURL" value="http://localhost/photo/"></add>
</appSettings>
<connectionStrings>
<add name="PORTAL" providerName="System.Data.SqlClient" connectionString="Password=sql;User ID=sa;Data Source=(local);database=Etool;" />
</connectionStrings>
<location path="Css">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
<location path="Js">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
<location path="images">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
<location path="ForgotPassword.aspx">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
</assemblies>
</compilation>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Forms">
<forms loginUrl="Login.aspx" name=".ASPXAUTH" defaultUrl="Login.aspx" protection="All" path="/"></forms>
</authentication>
<machineKey validationKey="282487E295028E59B8F411ACB689CCD6F39DDD21E6055A3EE480424315994760ADF21B580D8587DB675FA02F79167413044E25309CCCDB647174D5B3D0DD9141" decryptionKey="8B6697227CBCA902B1A0925D40FAA00B353F2DF4359D2099" validation="SHA1" />
<authorization>
<deny users="?" />
<allow users="*" />
</authorization>
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
<httpRuntime requestValidationMode="2.0" />
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID" validateRequest="false" />
</system.web>
<system.webServer>
<defaultDocument>
<files>
<add value="login.aspx" />
</files>
</defaultDocument>
<directoryBrowse enabled="true" />
</system.webServer>
</configuration>