HTTP错误500.19 - 更改web.config时出现内部服务器错误

时间:2015-08-10 08:08:23

标签: asp.net

我想在我的网站上添加注册功能。当我在Web.config中添加配置时,我在运行项目时遇到以下错误:

  

HTTP错误500.19 - 内部服务器错误请求的页面不能   访问,因为页面的相关配置数据是   无效

详细说明:

 Detailed Error Information:
    Module     IIS Web Core
    Notification       Unknown
    Handler    Not yet determined
    Error Code     0x80070032
    Config Error       The configuration section 'authentication' cannot be read because it is missing a section declaration

我的web.config:

<connectionStrings>      
    <add name="Model12" connectionString="data source=.\SQLEXPRESS;initial catalog=test123;integrated security=True; />
  </connectionStrings>

  <authentication mode="Forms">
 <forms loginUrl="~/FirstPage.aspx" timeout="2880" />
</authentication>

 <membership defaultProvider="CustomMembershipProvider">
     <providers>
     <clear />
     <add name="CustomMembershipProvider"
          type="MyMembershipProvider"
          connectionStringName="Model12"
          enablePasswordReset="true"
          maxInvalidPasswordAttempts="5"
          minRequiredPasswordLength="6"
          minRequiredNonalphanumericCharacters="0"
          passwordAttemptWindow="10"
          applicationName="/" />
     </providers>
</membership>

可能是什么问题?

1 个答案:

答案 0 :(得分:4)

您从IIS获取的消息告诉您它无法识别“connectionStrings”元素下面的“authentication”元素。这是因为它应该保存在'system.web'元素中,如下所示:

<system.web>
    <!-- Other system.web sections here-->
    <authentication mode="Forms">
        <forms loginUrl="~/FirstPage.aspx" timeout="2880"/>
    </authentication>
</system.web>