0
我想將所有錯誤捕獲到default.aspx文件中,而不管服務器上發生了什麼。system.webserver中的httperrors無法在azure上工作
在web.config中,我說:
<system.webServer>
<httpErrors errorMode="Custom" defaultResponseMode="ExecuteURL" defaultPath="~/Default.aspx" existingResponse="Replace" >
<remove statusCode="404"/>
<remove statusCode="500"/>
<error statusCode="404" path="~/Default.aspx" responseMode="ExecuteURL"/>
<error statusCode="500" path="~/Default.aspx" responseMode="ExecuteURL"/>
</httpErrors>
</system.webServer>
它不工作。在一個問題中,我讀了關於允許重寫HttpErrors部分,但添加configSection中的某些內容不起作用,因爲type元素缺失。不知道那裏需要什麼。
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=ZZZZZZZZZ" requirePermission="false" />
<section name="httpErrors" allowOverride="true"/>
</configSections>