[英]How to continue standart Asp.net Mvc - Application Error Page
如果我的MVC應用程序以發布模式(發布模式)運行,則處理了所有錯誤消息
但是,當我在調試模式下工作時,看不到標准的mvc應用程序錯誤頁面。
因為它將重定向到位於共享文件夾中的Error.cshtml。
如何查看(或重定向?)標准的MVC錯誤頁面?
protected void Application_Error()
{
// ReSharper disable once RedundantAssignment
// ReSharper disable once ConvertToConstant.Local
bool isCustomErrorEnabled = false;
-#if(!DEBUG)isCustomErrorEnabled = true; - #萬一
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
if (isCustomErrorEnabled) //Context.IsCustomErrorEnabled
{
ShowCustomErrorPage(Server.GetLastError());
}
else
{
//in this line, I want to continue to show standart
// application error page which has error message and stack trace
}
}
更新-這是我的Web.Config文件;
<system.web>
<authentication mode="None" />
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
<globalization uiCulture="auto" culture="auto" />
<customErrors defaultRedirect="/Home/OldLink" mode="On" redirectMode="ResponseRewrite">
<!-- RemoteOnly : Specifies that custom errors are shown only to the remote clients, and that ASP.NET errors are shown to the local host. This is the default value. -->
</customErrors>
MVC 4使用HandleError屬性處理錯誤的默認支持將您重定向到Error.cshtml。
只需使用customErrors mode="off"
更新您的web.config
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.