diff --git a/Bootstrap.Client/Controllers/HomeController.cs b/Bootstrap.Client/Controllers/HomeController.cs index dab8bed9..6cbc4321 100644 --- a/Bootstrap.Client/Controllers/HomeController.cs +++ b/Bootstrap.Client/Controllers/HomeController.cs @@ -1,7 +1,6 @@ using Bootstrap.Client.Models; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using System.Diagnostics; namespace Bootstrap.Client.Controllers { @@ -26,7 +25,7 @@ namespace Bootstrap.Client.Controllers [AllowAnonymous] public IActionResult Error(int id) { - return id == 404 ? View("NotFound") : View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); + return id == 404 ? View("NotFound") : View(); } } } diff --git a/Bootstrap.Client/Models/ErrorViewModel.cs b/Bootstrap.Client/Models/ErrorViewModel.cs deleted file mode 100644 index 82071022..00000000 --- a/Bootstrap.Client/Models/ErrorViewModel.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace Bootstrap.Client.Models -{ - /// - /// - /// - public class ErrorViewModel - { - /// - /// - /// - public string RequestId { get; set; } - /// - /// - /// - public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); - } -} \ No newline at end of file diff --git a/Bootstrap.Client/Views/Home/Error.cshtml b/Bootstrap.Client/Views/Home/Error.cshtml index 3050011e..a0551813 100644 --- a/Bootstrap.Client/Views/Home/Error.cshtml +++ b/Bootstrap.Client/Views/Home/Error.cshtml @@ -1,23 +1,17 @@ -@model ErrorViewModel -@{ - ViewData["Title"] = "Error"; - Layout = "_Root"; +@{ + ViewBag.Title = "服务器内部错误"; + Layout = "_Layout"; } - -

Error.

-

An error occurred while processing your request.

- -@if (Model.ShowRequestId) -{ -

- Request ID: @Model.RequestId -

+@section css { + } - -

Development Mode

-

- Swapping to Development environment will display more detailed information about the error that occurred. -

-

- Development environment should not be enabled in deployed applications, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable to Development, and restarting the application. -

+@section javascript { + +} +
+ +

服务器内部错误

+

相关错误信息已经记录到日志中,请登录服务器查看

+
+ 返回首页 +
\ No newline at end of file