我已经将我的网页上传到服务器。
我的网页在本地系统中运行良好。但是当我将它上传到服务器时却显示错误
The configuration section 'customErrors' cannot be read because it is missing a section declaration.
我已经尝试了所有的可能性,但仍然出现上述错误。谁能建议我应该在我的配置文件中更改什么来解决这个问题?
我的网络配置文件:
<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+[&-]*\w+)/*((\w+[&-]*\w+)(\s)*)*/*((\w+[&-]*\w+)(\s)*)*$" destination="landPage.aspx?CampaginName=$1&SubDomain=$2&UserName=$3&PageName=$4" />
<!-- <rule source=".*" destination="landPage.aspx?CampaginName=$1&UserName=$2"/>-->
</rewriteRules>
</rewriteModule>
</modulesSection>
最佳答案
<CustomErrors>
属于 <system.web>
你有你的 <configuration>
直接地。也就是说,您的 customErrors 标记的父元素是配置,这是不正确的。检查MSDN on customErrors将向您显示正确的结构以将其添加到您的配置文件中。
<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>
关于c# - 无法读取配置部分 'customErrors',因为它缺少部分声明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9250029/