无法读取配置节'customErrors',因为它缺少节声明

San*_*ahu 10 c# asp.net web-config

我已将我的网页上传到服务器.

我的网页在本地系统中运行良好.但是当我将它上传到服务器时,它显示错误

无法读取配置节'customErrors',因为它缺少节声明.

我已经尝试了所有的可能性,但我仍然得到上述错误.任何人都可以建议我应该在配置文件中更改什么来解决问题?

我的Webconfig文件:

<configuration>
    <configSections>
        <section name="neatUpload" type="Brettle.Web.NeatUpload.ConfigSectionHandler, Brettle.Web.NeatUpload" allowLocation="true" />
        <sectionGroup name="modulesSection">
            <section name="rewriteModule" type="RewriteModule.RewriteModuleSectionHandler, RewriteModule" />
        </sectionGroup>
    </configSections>
    <!-- <customErrors mode="ON" /> -->
    <!--  <customErrors mode="Off" />  -->
    <customErrors mode="ON" defaultRedirect="GenericErrorPage.html">
         <!--   <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" /> -->
    </customErrors>
    <modulesSection>
        <rewriteModule>
            <rewriteOn>true</rewriteOn>
            <rewriteRules>
            <rule source="http://[^/]*/*(\w+[&amp;-]*\w+)/*((\w+[&amp;-]*\w+)(\s)*)*/*((\w+[&amp;-]*\w+)(\s)*)*$" destination="landPage.aspx?CampaginName=$1&amp;SubDomain=$2&amp;UserName=$3&amp;PageName=$4" />
            <!-- <rule source=".*" destination="landPage.aspx?CampaginName=$1&amp;UserName=$2"/>-->
            </rewriteRules>
        </rewriteModule>
    </modulesSection>
Run Code Online (Sandbox Code Playgroud)

Phi*_*eck 20

<CustomErrors><system.web> 你下<configuration>直接拥有你的.也就是说,customErrors标记的父元素是配置,这是不正确的.在customErrors上检查MSDN将显示将其添加到配置文件的正确结构.

<configuration>
    <!-- your other stuff -->
    <system.web>
        <customErrors mode="ON" defaultRedirect="GenericErrorPage.html">
             <!--   <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" /> -->
        </customErrors>
    </system.web>
</configuration>
Run Code Online (Sandbox Code Playgroud)