2013-03-23 107 views
3
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虚拟directory.I试图配置虚拟目录在IIS并启用表单验证我得到的错误,但它也显示了错误:配置部分不允许被设置为低于应用窗体身份验证错误

我的web.config文件是

<?xml version="1.0" encoding="UTF-8"?> 
<configuration> 
    <appSettings> 
    <add key="smtpcon" value="smtp.gmail.com"></add> 
    <add key="USERNAME" value="[email protected]"></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> 

回答

0

最有可能的问题是与您的授权部分。在这里发布整个web.config文件,以便可以修复。您的IIS配置没有问题,但仅使用web.config文件。

另一个想法是,创建一个新项目,看看web.config文件中有什么不同以及web.config文件的授权部分如何配置。这会在web.config文件中给你提示一些问题。

编辑

明白了,原因是,你在你的项目中多个web.config文件。请检查整个项目目录,并确保项目目录中只有一个web.config文件。

+0

但我在项目中只有一个web.config文件 – user2185871 2013-03-23 06:57:51

5

将虚拟目录转换为消息中建议的应用程序。右键单击IIS中的虚拟目录,您将看到该选项。