2012-02-12 214 views
9

我已經上傳自己的網頁服務器。配置節「的customErrors」不能讀,因爲它缺少一個部分聲明

我的網頁在本地系統工作正常。但是,當我把它上傳到服務器時,它顯示錯誤

配置節「的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> 

回答

18

<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> 
+0

感謝ü您的回覆。這樣做後,它顯示「無法識別的元素'system.web'」錯誤 – 2012-02-12 16:06:22

+1

我願意打賭你有你的system.web嵌套在另一個部分,或在configSections之前的頂部。確保''出現在你的後面' – 2012-02-12 16:17:44

+0

是的你是對的。 thanx for ur help ... – 2012-02-12 17:40:48

相關問題