* fix #12516 by cleaning up error page * add a Diagnostics.slnf because I was there * missed the IIS update * update WebHost's error page * Fix slnf path
This commit is contained in:
parent
e0d522e1f7
commit
cac51846e9
|
|
@ -167,6 +167,7 @@ namespace Microsoft.AspNetCore.Hosting
|
|||
.InformationalVersion;
|
||||
model.ClrVersion = clrVersion;
|
||||
model.OperatingSystemDescription = RuntimeInformation.OSDescription;
|
||||
model.ShowRuntimeDetails = showDetailedErrors;
|
||||
|
||||
if (showDetailedErrors)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -264,6 +264,7 @@ namespace Microsoft.AspNetCore.Hosting
|
|||
.InformationalVersion;
|
||||
model.ClrVersion = clrVersion;
|
||||
model.OperatingSystemDescription = RuntimeInformation.OSDescription;
|
||||
model.ShowRuntimeDetails = showDetailedErrors;
|
||||
|
||||
if (showDetailedErrors)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
"solution": {
|
||||
"path": "..\\Middleware.sln",
|
||||
"projects": [
|
||||
"..\\Hosting\\Abstractions\\src\\Microsoft.AspNetCore.Hosting.Abstractions.csproj",
|
||||
"..\\Hosting\\Hosting\\src\\Microsoft.AspNetCore.Hosting.csproj",
|
||||
"..\\Hosting\\Server.Abstractions\\src\\Microsoft.AspNetCore.Hosting.Server.Abstractions.csproj",
|
||||
"..\\Hosting\\TestHost\\src\\Microsoft.AspNetCore.TestHost.csproj",
|
||||
"..\\Http\\Authentication.Abstractions\\src\\Microsoft.AspNetCore.Authentication.Abstractions.csproj",
|
||||
"..\\Http\\Authentication.Core\\src\\Microsoft.AspNetCore.Authentication.Core.csproj",
|
||||
"..\\Http\\Http.Abstractions\\src\\Microsoft.AspNetCore.Http.Abstractions.csproj",
|
||||
"..\\Http\\Http.Extensions\\src\\Microsoft.AspNetCore.Http.Extensions.csproj",
|
||||
"..\\Http\\Http.Features\\src\\Microsoft.AspNetCore.Http.Features.csproj",
|
||||
"..\\Http\\Metadata\\src\\Microsoft.AspNetCore.Metadata.csproj",
|
||||
"..\\Http\\Routing.Abstractions\\src\\Microsoft.AspNetCore.Routing.Abstractions.csproj",
|
||||
"..\\Http\\WebUtilities\\src\\Microsoft.AspNetCore.WebUtilities.csproj",
|
||||
"..\\Security\\Authorization\\Core\\src\\Microsoft.AspNetCore.Authorization.csproj",
|
||||
"..\\Servers\\Connections.Abstractions\\src\\Microsoft.AspNetCore.Connections.Abstractions.csproj",
|
||||
"..\\Servers\\IIS\\IISIntegration\\src\\Microsoft.AspNetCore.Server.IISIntegration.csproj",
|
||||
"..\\Servers\\Kestrel\\Core\\src\\Microsoft.AspNetCore.Server.Kestrel.Core.csproj",
|
||||
"..\\Servers\\Kestrel\\Kestrel\\src\\Microsoft.AspNetCore.Server.Kestrel.csproj",
|
||||
"..\\Servers\\Kestrel\\Transport.Sockets\\src\\Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.csproj",
|
||||
"..\\http\\Headers\\src\\Microsoft.Net.Http.Headers.csproj",
|
||||
"..\\http\\Routing\\src\\Microsoft.AspNetCore.Routing.csproj",
|
||||
"..\\http\\http\\src\\Microsoft.AspNetCore.Http.csproj",
|
||||
"Diagnostics.Abstractions\\src\\Microsoft.AspNetCore.Diagnostics.Abstractions.csproj",
|
||||
"Diagnostics.EntityFrameworkCore\\src\\Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.csproj",
|
||||
"Diagnostics.EntityFrameworkCore\\test\\FunctionalTests\\Diagnostics.EFCore.FunctionalTests.csproj",
|
||||
"Diagnostics.EntityFrameworkCore\\test\\UnitTests\\Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.Tests.csproj",
|
||||
"Diagnostics\\src\\Microsoft.AspNetCore.Diagnostics.csproj",
|
||||
"Diagnostics\\test\\FunctionalTests\\Diagnostics.FunctionalTests.csproj",
|
||||
"Diagnostics\\test\\UnitTests\\Microsoft.AspNetCore.Diagnostics.Tests.csproj",
|
||||
"Diagnostics\\test\\testassets\\ClassLibraryWithPortablePdbs\\ClassLibraryWithPortablePdbs.csproj",
|
||||
"Diagnostics\\test\\testassets\\DatabaseErrorPageSample\\DatabaseErrorPageSample.csproj",
|
||||
"Diagnostics\\test\\testassets\\DeveloperExceptionPageSample\\DeveloperExceptionPageSample.csproj",
|
||||
"Diagnostics\\test\\testassets\\ExceptionHandlerSample\\ExceptionHandlerSample.csproj",
|
||||
"Diagnostics\\test\\testassets\\StatusCodePagesSample\\StatusCodePagesSample.csproj",
|
||||
"Diagnostics\\test\\testassets\\WelcomePageSample\\WelcomePageSample.csproj",
|
||||
"HttpOverrides\\src\\Microsoft.AspNetCore.HttpOverrides.csproj",
|
||||
"MiddlewareAnalysis\\samples\\MiddlewareAnalysisSample\\MiddlewareAnalysisSample.csproj",
|
||||
"MiddlewareAnalysis\\src\\Microsoft.AspNetCore.MiddlewareAnalysis.csproj",
|
||||
"StaticFiles\\src\\Microsoft.AspNetCore.StaticFiles.csproj"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -83,7 +83,10 @@ internal class StartupHook
|
|||
new PhysicalFileProvider(contentRoot),
|
||||
sourceCodeLineCount: 6);
|
||||
|
||||
// The startup hook is only present when detailed errors are allowed, so
|
||||
// we can turn on all the details.
|
||||
model.ErrorDetails = exceptionDetailProvider.GetDetails(exception);
|
||||
model.ShowRuntimeDetails = true;
|
||||
|
||||
var errorPage = new ErrorPage(model);
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -16,6 +16,8 @@ namespace Microsoft.AspNetCore.Hosting.Views
|
|||
/// </summary>
|
||||
public IEnumerable<ExceptionDetails> ErrorDetails { get; set; }
|
||||
|
||||
public bool ShowRuntimeDetails { get; set; }
|
||||
|
||||
public string RuntimeDisplayName { get; set; }
|
||||
|
||||
public string RuntimeArchitecture { get; set; }
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
param(
|
||||
[Parameter(Mandatory = $true)][string]$ToolingRepoPath
|
||||
)
|
||||
|
||||
$ToolPath = Join-Path $ToolingRepoPath "artifacts\bin\RazorPageGenerator\Debug\netcoreapp3.0\dotnet-razorpagegenerator.exe"
|
||||
|
||||
if (!(Test-Path $ToolPath)) {
|
||||
throw "Unable to find razor page generator tool at $ToolPath"
|
||||
}
|
||||
|
||||
& "$ToolPath" Microsoft.AspNetCore.Hosting.Views $PSScriptRoot
|
||||
|
||||
$TargetPath = Join-Path $PSScriptRoot "ErrorPage.Designer.cs"
|
||||
if (Test-Path $TargetPath) {
|
||||
Remove-Item $TargetPath
|
||||
}
|
||||
|
||||
Move-Item "$PSScriptRoot\Views\ErrorPage.Designer.cs" $PSScriptRoot
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
# Error Page
|
||||
|
||||
This folder is shared among multiple projects. The `ErrorPage.Designer.cs` and `ErrorPageModel.cs` files are used to render this view. The `ErrorPage.Designer.cs` file is generated by rendering `src/Views/ErrorPage.cshtml` using the [RazorPageGenerator](https://github.com/aspnet/AspNetCore-Tooling/tree/master/src/Razor/src/RazorPageGenerator) tool.
|
||||
|
||||
## Making changes to ErrorPage.cshtml
|
||||
|
||||
1. Clone aspnet/AspNetCore-Tooling
|
||||
1. Run `./build.cmd` in **that repo**
|
||||
1. Edit the file
|
||||
1. Run the `GeneratePage` script, passing in the path to the `aspnet/AspNetCore-Tooling` repo root.
|
||||
|
||||
```
|
||||
.\GeneratePage -ToolingRepoPath C:\Code\aspnet\AspNetCore-Tooling
|
||||
```
|
||||
|
|
@ -31,12 +31,11 @@
|
|||
@foreach (var errorDetail in Model.ErrorDetails)
|
||||
{
|
||||
<div class="titleerror">@errorDetail.Error.GetType().Name: @{ Output.Write(HtmlEncodeAndReplaceLineBreaks(errorDetail.Error.Message)); }</div>
|
||||
@{
|
||||
var firstFrame = errorDetail.StackFrames.FirstOrDefault();
|
||||
if (firstFrame != null)
|
||||
{
|
||||
location = firstFrame.Function;
|
||||
}
|
||||
|
||||
var firstFrame = errorDetail.StackFrames.FirstOrDefault();
|
||||
if (firstFrame != null)
|
||||
{
|
||||
location = firstFrame.Function;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(location) && firstFrame != null && !string.IsNullOrEmpty(firstFrame.File))
|
||||
{
|
||||
|
|
@ -76,19 +75,15 @@
|
|||
}
|
||||
@foreach (var errorDetail in Model.ErrorDetails)
|
||||
{
|
||||
@{
|
||||
exceptionCount++;
|
||||
exceptionDetailId = "exceptionDetail" + exceptionCount;
|
||||
}
|
||||
exceptionCount++;
|
||||
exceptionDetailId = "exceptionDetail" + exceptionCount;
|
||||
<li>
|
||||
<h2 class="stackerror">@errorDetail.Error.GetType().Name: @errorDetail.Error.Message</h2>
|
||||
<ul>
|
||||
@foreach (var frame in errorDetail.StackFrames)
|
||||
{
|
||||
@{
|
||||
stackFrameCount++;
|
||||
frameId = "frame" + stackFrameCount;
|
||||
}
|
||||
stackFrameCount++;
|
||||
frameId = "frame" + stackFrameCount;
|
||||
<li class="frame" id="@frameId">
|
||||
@if (string.IsNullOrEmpty(frame.File))
|
||||
{
|
||||
|
|
@ -149,9 +144,11 @@
|
|||
}
|
||||
</ul>
|
||||
</div>
|
||||
<footer>
|
||||
@Model.RuntimeDisplayName @Model.RuntimeArchitecture v@(Model.ClrVersion) | Microsoft.AspNetCore.Hosting version @Model.CurrentAssemblyVesion | @Model.OperatingSystemDescription | <a href="http://go.microsoft.com/fwlink/?LinkId=517394">Need help?</a>
|
||||
</footer>
|
||||
@if (Model.ShowRuntimeDetails) {
|
||||
<footer>
|
||||
@Model.RuntimeDisplayName @Model.RuntimeArchitecture v@(Model.ClrVersion) | Microsoft.AspNetCore.Hosting version @Model.CurrentAssemblyVesion | @Model.OperatingSystemDescription | <a href="http://go.microsoft.com/fwlink/?LinkId=517394">Need help?</a>
|
||||
</footer>
|
||||
}
|
||||
<script>
|
||||
//<!--
|
||||
<%$ include: ErrorPage.js %>
|
||||
Loading…
Reference in New Issue