[Fixes #279] Deleted RuntimeInfo middleware, sample and tests
This commit is contained in:
parent
9a411df59f
commit
af19899927
|
|
@ -1,6 +1,6 @@
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 14
|
# Visual Studio 14
|
||||||
VisualStudioVersion = 14.0.24720.0
|
VisualStudioVersion = 14.0.25123.0
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{509A6F36-AD80-4A18-B5B1-717D38DFF29D}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{509A6F36-AD80-4A18-B5B1-717D38DFF29D}"
|
||||||
EndProject
|
EndProject
|
||||||
|
|
@ -19,8 +19,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
|
||||||
global.json = global.json
|
global.json = global.json
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "RuntimeInfoPageSample", "samples\RuntimeInfoPageSample\RuntimeInfoPageSample.xproj", "{CD62A191-39F5-4C86-BC1D-7731085120F5}"
|
|
||||||
EndProject
|
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{2AF90579-B118-4583-AE88-672EFACB5BC4}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{2AF90579-B118-4583-AE88-672EFACB5BC4}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Diagnostics.Tests", "test\Microsoft.AspNetCore.Diagnostics.Tests\Microsoft.AspNetCore.Diagnostics.Tests.xproj", "{994351B4-7B2A-4139-8B72-72C5BB5CC618}"
|
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Diagnostics.Tests", "test\Microsoft.AspNetCore.Diagnostics.Tests\Microsoft.AspNetCore.Diagnostics.Tests.xproj", "{994351B4-7B2A-4139-8B72-72C5BB5CC618}"
|
||||||
|
|
@ -103,16 +101,6 @@ Global
|
||||||
{4D4A785A-ECB9-4916-A88F-0FD306EE3B74}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
{4D4A785A-ECB9-4916-A88F-0FD306EE3B74}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||||
{4D4A785A-ECB9-4916-A88F-0FD306EE3B74}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
{4D4A785A-ECB9-4916-A88F-0FD306EE3B74}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||||
{4D4A785A-ECB9-4916-A88F-0FD306EE3B74}.Release|x86.ActiveCfg = Release|Any CPU
|
{4D4A785A-ECB9-4916-A88F-0FD306EE3B74}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
{CD62A191-39F5-4C86-BC1D-7731085120F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{CD62A191-39F5-4C86-BC1D-7731085120F5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{CD62A191-39F5-4C86-BC1D-7731085120F5}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
|
||||||
{CD62A191-39F5-4C86-BC1D-7731085120F5}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
|
||||||
{CD62A191-39F5-4C86-BC1D-7731085120F5}.Debug|x86.ActiveCfg = Debug|Any CPU
|
|
||||||
{CD62A191-39F5-4C86-BC1D-7731085120F5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{CD62A191-39F5-4C86-BC1D-7731085120F5}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{CD62A191-39F5-4C86-BC1D-7731085120F5}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
|
||||||
{CD62A191-39F5-4C86-BC1D-7731085120F5}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
|
||||||
{CD62A191-39F5-4C86-BC1D-7731085120F5}.Release|x86.ActiveCfg = Release|Any CPU
|
|
||||||
{994351B4-7B2A-4139-8B72-72C5BB5CC618}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{994351B4-7B2A-4139-8B72-72C5BB5CC618}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{994351B4-7B2A-4139-8B72-72C5BB5CC618}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{994351B4-7B2A-4139-8B72-72C5BB5CC618}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{994351B4-7B2A-4139-8B72-72C5BB5CC618}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
{994351B4-7B2A-4139-8B72-72C5BB5CC618}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||||
|
|
@ -298,7 +286,6 @@ Global
|
||||||
{68A1F0E1-ECCE-46D1-B20F-C43EE5B097DE} = {509A6F36-AD80-4A18-B5B1-717D38DFF29D}
|
{68A1F0E1-ECCE-46D1-B20F-C43EE5B097DE} = {509A6F36-AD80-4A18-B5B1-717D38DFF29D}
|
||||||
{589AC17F-9455-4764-8F82-FCD2AE58DA14} = {ACAA0157-A8C4-4152-93DE-90CCDF304087}
|
{589AC17F-9455-4764-8F82-FCD2AE58DA14} = {ACAA0157-A8C4-4152-93DE-90CCDF304087}
|
||||||
{4D4A785A-ECB9-4916-A88F-0FD306EE3B74} = {509A6F36-AD80-4A18-B5B1-717D38DFF29D}
|
{4D4A785A-ECB9-4916-A88F-0FD306EE3B74} = {509A6F36-AD80-4A18-B5B1-717D38DFF29D}
|
||||||
{CD62A191-39F5-4C86-BC1D-7731085120F5} = {ACAA0157-A8C4-4152-93DE-90CCDF304087}
|
|
||||||
{994351B4-7B2A-4139-8B72-72C5BB5CC618} = {2AF90579-B118-4583-AE88-672EFACB5BC4}
|
{994351B4-7B2A-4139-8B72-72C5BB5CC618} = {2AF90579-B118-4583-AE88-672EFACB5BC4}
|
||||||
{427CDB36-78B0-4583-9EBC-7F283DE60355} = {ACAA0157-A8C4-4152-93DE-90CCDF304087}
|
{427CDB36-78B0-4583-9EBC-7F283DE60355} = {ACAA0157-A8C4-4152-93DE-90CCDF304087}
|
||||||
{4F5A6A72-FFE4-49C4-B4C6-58132CFCB9FE} = {509A6F36-AD80-4A18-B5B1-717D38DFF29D}
|
{4F5A6A72-FFE4-49C4-B4C6-58132CFCB9FE} = {509A6F36-AD80-4A18-B5B1-717D38DFF29D}
|
||||||
|
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup>
|
|
||||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
|
|
||||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
|
|
||||||
<PropertyGroup Label="Globals">
|
|
||||||
<ProjectGuid>cd62a191-39f5-4c86-bc1d-7731085120f5</ProjectGuid>
|
|
||||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
|
|
||||||
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\</OutputPath>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup>
|
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
|
||||||
<DevelopmentServerPort>62670</DevelopmentServerPort>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
|
|
||||||
</Project>
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Microsoft.AspNetCore.Builder;
|
|
||||||
using Microsoft.AspNetCore.Hosting;
|
|
||||||
|
|
||||||
namespace RuntimeInfoPageSample
|
|
||||||
{
|
|
||||||
public class Startup
|
|
||||||
{
|
|
||||||
public void Configure(IApplicationBuilder app)
|
|
||||||
{
|
|
||||||
app.UseRuntimeInfoPage();
|
|
||||||
|
|
||||||
app.Run(context =>
|
|
||||||
{
|
|
||||||
context.Response.StatusCode = 302;
|
|
||||||
context.Response.Headers["Location"] = "/runtimeinfo";
|
|
||||||
|
|
||||||
return Task.FromResult(0);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void Main(string[] args)
|
|
||||||
{
|
|
||||||
var host = new WebHostBuilder()
|
|
||||||
.UseKestrel()
|
|
||||||
.UseIISIntegration()
|
|
||||||
.UseStartup<Startup>()
|
|
||||||
.Build();
|
|
||||||
|
|
||||||
host.Run();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,39 +0,0 @@
|
||||||
{
|
|
||||||
"dependencies": {
|
|
||||||
"Microsoft.NETCore.Platforms": "1.0.1-*",
|
|
||||||
"Microsoft.AspNetCore.Diagnostics": "1.0.0-*",
|
|
||||||
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-*",
|
|
||||||
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*"
|
|
||||||
},
|
|
||||||
"buildOptions": {
|
|
||||||
"emitEntryPoint": true
|
|
||||||
},
|
|
||||||
"frameworks": {
|
|
||||||
"net451": {},
|
|
||||||
"netcoreapp1.0": {
|
|
||||||
"imports": [
|
|
||||||
"dnxcore50"
|
|
||||||
],
|
|
||||||
"dependencies": {
|
|
||||||
"Microsoft.NETCore.App": {
|
|
||||||
"version": "1.0.0-*",
|
|
||||||
"type": "platform"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"publishOptions": {
|
|
||||||
"include": [
|
|
||||||
"web.config"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"tools": {
|
|
||||||
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
|
|
||||||
"version": "1.0.0-*",
|
|
||||||
"imports": "portable-net45+wp80+win8+wpa81+dnxcore50"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"postpublish": "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
<?xml version="1.0"?>
|
|
||||||
<configuration>
|
|
||||||
<system.webServer>
|
|
||||||
<handlers>
|
|
||||||
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
|
|
||||||
</handlers>
|
|
||||||
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" />
|
|
||||||
</system.webServer>
|
|
||||||
</configuration>
|
|
||||||
|
|
@ -2,11 +2,11 @@
|
||||||
"version": "0.1.0-*",
|
"version": "0.1.0-*",
|
||||||
"description": "ASP.NET Core Error Logging Middleware (ELM) to capture and display request logs.",
|
"description": "ASP.NET Core Error Logging Middleware (ELM) to capture and display request logs.",
|
||||||
"buildOptions": {
|
"buildOptions": {
|
||||||
"warningsAsErrors": true,
|
|
||||||
"keyFile": "../../tools/Key.snk",
|
"keyFile": "../../tools/Key.snk",
|
||||||
"nowarn": [
|
"nowarn": [
|
||||||
"CS1591"
|
"CS1591"
|
||||||
],
|
],
|
||||||
|
"warningsAsErrors": true,
|
||||||
"xmlDoc": true
|
"xmlDoc": true
|
||||||
},
|
},
|
||||||
"packOptions": {
|
"packOptions": {
|
||||||
|
|
@ -39,8 +39,5 @@
|
||||||
"System.Threading": "4.0.11-*"
|
"System.Threading": "4.0.11-*"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
"compileExclude": [
|
|
||||||
"Views/*.cshtml"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,52 +0,0 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using Microsoft.AspNetCore.Diagnostics;
|
|
||||||
using Microsoft.AspNetCore.Http;
|
|
||||||
using Microsoft.Extensions.Options;
|
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Builder
|
|
||||||
{
|
|
||||||
public static class RuntimeInfoExtensions
|
|
||||||
{
|
|
||||||
public static IApplicationBuilder UseRuntimeInfoPage(this IApplicationBuilder app)
|
|
||||||
{
|
|
||||||
if (app == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(app));
|
|
||||||
}
|
|
||||||
|
|
||||||
return app.UseMiddleware<RuntimeInfoMiddleware>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IApplicationBuilder UseRuntimeInfoPage(this IApplicationBuilder app, string path)
|
|
||||||
{
|
|
||||||
if (app == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(app));
|
|
||||||
}
|
|
||||||
|
|
||||||
return app.UseRuntimeInfoPage(new RuntimeInfoPageOptions
|
|
||||||
{
|
|
||||||
Path = new PathString(path)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IApplicationBuilder UseRuntimeInfoPage(
|
|
||||||
this IApplicationBuilder app,
|
|
||||||
RuntimeInfoPageOptions options)
|
|
||||||
{
|
|
||||||
if (app == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(app));
|
|
||||||
}
|
|
||||||
if (options == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(options));
|
|
||||||
}
|
|
||||||
|
|
||||||
return app.UseMiddleware<RuntimeInfoMiddleware>(Options.Create(options));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,74 +0,0 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Microsoft.AspNetCore.Builder;
|
|
||||||
using Microsoft.AspNetCore.Diagnostics.Views;
|
|
||||||
using Microsoft.AspNetCore.Http;
|
|
||||||
using Microsoft.Extensions.Options;
|
|
||||||
using Microsoft.Extensions.PlatformAbstractions;
|
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Diagnostics
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Displays information about the packages used by the application at runtime
|
|
||||||
/// </summary>
|
|
||||||
public class RuntimeInfoMiddleware
|
|
||||||
{
|
|
||||||
private readonly RequestDelegate _next;
|
|
||||||
private readonly RuntimeInfoPageOptions _options;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="RuntimeInfoMiddleware"/> class
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="next"></param>
|
|
||||||
/// <param name="options"></param>
|
|
||||||
public RuntimeInfoMiddleware(
|
|
||||||
RequestDelegate next,
|
|
||||||
IOptions<RuntimeInfoPageOptions> options)
|
|
||||||
{
|
|
||||||
if (next == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(next));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (options == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(options));
|
|
||||||
}
|
|
||||||
|
|
||||||
_next = next;
|
|
||||||
_options = options.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Process an individual request.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="context"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public Task Invoke(HttpContext context)
|
|
||||||
{
|
|
||||||
var request = context.Request;
|
|
||||||
if (!_options.Path.HasValue || _options.Path == request.Path)
|
|
||||||
{
|
|
||||||
var model = CreateRuntimeInfoModel();
|
|
||||||
var runtimeInfoPage = new RuntimeInfoPage(model);
|
|
||||||
return runtimeInfoPage.ExecuteAsync(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
return _next(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static RuntimeInfoPageModel CreateRuntimeInfoModel()
|
|
||||||
{
|
|
||||||
var model = new RuntimeInfoPageModel();
|
|
||||||
var runtimeEnvironment = PlatformServices.Default.Runtime;
|
|
||||||
model.Version = runtimeEnvironment.RuntimeVersion;
|
|
||||||
model.OperatingSystem = runtimeEnvironment.OperatingSystem;
|
|
||||||
model.RuntimeType = runtimeEnvironment.RuntimeType;
|
|
||||||
model.RuntimeArchitecture = runtimeEnvironment.RuntimeArchitecture;
|
|
||||||
return model;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Http;
|
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Builder
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Options for the RuntimeInfoPage
|
|
||||||
/// </summary>
|
|
||||||
public class RuntimeInfoPageOptions
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="RuntimeInfoPageOptions" /> class
|
|
||||||
/// </summary>
|
|
||||||
public RuntimeInfoPageOptions()
|
|
||||||
{
|
|
||||||
Path = new PathString("/runtimeinfo");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Specifies which request path will be responded to. Exact match only. Set to null to handle all requests.
|
|
||||||
/// </summary>
|
|
||||||
public PathString Path { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,141 +0,0 @@
|
||||||
namespace Microsoft.AspNetCore.Diagnostics.Views
|
|
||||||
{
|
|
||||||
#line 1 "RuntimeInfoPage.cshtml"
|
|
||||||
using System
|
|
||||||
|
|
||||||
#line default
|
|
||||||
#line hidden
|
|
||||||
;
|
|
||||||
#line 2 "RuntimeInfoPage.cshtml"
|
|
||||||
using System.Globalization
|
|
||||||
|
|
||||||
#line default
|
|
||||||
#line hidden
|
|
||||||
;
|
|
||||||
#line 3 "RuntimeInfoPage.cshtml"
|
|
||||||
using System.Linq
|
|
||||||
|
|
||||||
#line default
|
|
||||||
#line hidden
|
|
||||||
;
|
|
||||||
#line 4 "RuntimeInfoPage.cshtml"
|
|
||||||
using Microsoft.AspNetCore.Diagnostics
|
|
||||||
|
|
||||||
#line default
|
|
||||||
#line hidden
|
|
||||||
;
|
|
||||||
#line 5 "RuntimeInfoPage.cshtml"
|
|
||||||
using Microsoft.AspNetCore.Diagnostics.Views
|
|
||||||
|
|
||||||
#line default
|
|
||||||
#line hidden
|
|
||||||
;
|
|
||||||
#line 6 "RuntimeInfoPage.cshtml"
|
|
||||||
using Microsoft.Extensions.PlatformAbstractions;
|
|
||||||
|
|
||||||
#line default
|
|
||||||
#line hidden
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
public class RuntimeInfoPage : Microsoft.AspNetCore.DiagnosticsViewPage.Views.BaseView
|
|
||||||
{
|
|
||||||
#line 9 "RuntimeInfoPage.cshtml"
|
|
||||||
|
|
||||||
public RuntimeInfoPage(RuntimeInfoPageModel model)
|
|
||||||
{
|
|
||||||
Model = model;
|
|
||||||
}
|
|
||||||
|
|
||||||
public RuntimeInfoPageModel Model { get; set; }
|
|
||||||
|
|
||||||
#line default
|
|
||||||
#line hidden
|
|
||||||
#line hidden
|
|
||||||
public RuntimeInfoPage()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma warning disable 1998
|
|
||||||
public override async Task ExecuteAsync()
|
|
||||||
{
|
|
||||||
WriteLiteral("\r\n");
|
|
||||||
#line 17 "RuntimeInfoPage.cshtml"
|
|
||||||
|
|
||||||
Response.ContentType = "text/html; charset=utf-8";
|
|
||||||
|
|
||||||
#line default
|
|
||||||
#line hidden
|
|
||||||
|
|
||||||
WriteLiteral("<!DOCTYPE html>\r\n<html");
|
|
||||||
BeginWriteAttribute("lang", " lang=\"", 457, "\"", 518, 1);
|
|
||||||
#line 21 "RuntimeInfoPage.cshtml"
|
|
||||||
WriteAttributeValue("", 464, CultureInfo.CurrentUICulture.TwoLetterISOLanguageName, 464, 54, false);
|
|
||||||
|
|
||||||
#line default
|
|
||||||
#line hidden
|
|
||||||
EndWriteAttribute();
|
|
||||||
WriteLiteral(" xmlns=\"http://www.w3.org/1999/xhtml\">\r\n<head>\r\n <meta charset=\"utf-8\" />\r\n <title>");
|
|
||||||
#line 24 "RuntimeInfoPage.cshtml"
|
|
||||||
Write(Resources.RuntimeInfoPage_Title);
|
|
||||||
|
|
||||||
#line default
|
|
||||||
#line hidden
|
|
||||||
WriteLiteral("</title>\r\n <style>\r\n <%$ include: RuntimeInfoPage.css % >\r\n </style>\r\n</head>\r\n<body>\r\n <h2>");
|
|
||||||
#line 30 "RuntimeInfoPage.cshtml"
|
|
||||||
Write(Resources.RuntimeInfoPage_Environment);
|
|
||||||
|
|
||||||
#line default
|
|
||||||
#line hidden
|
|
||||||
WriteLiteral("</h2>\r\n <p>");
|
|
||||||
#line 31 "RuntimeInfoPage.cshtml"
|
|
||||||
Write(Resources.RuntimeInfoPage_OperatingSystem);
|
|
||||||
|
|
||||||
#line default
|
|
||||||
#line hidden
|
|
||||||
WriteLiteral(" ");
|
|
||||||
#line 31 "RuntimeInfoPage.cshtml"
|
|
||||||
Write(string.IsNullOrWhiteSpace(Model.OperatingSystem) ? Resources.RuntimeInfoPage_OperatingSystemFail : Model.OperatingSystem);
|
|
||||||
|
|
||||||
#line default
|
|
||||||
#line hidden
|
|
||||||
WriteLiteral("</p>\r\n\r\n <p>");
|
|
||||||
#line 33 "RuntimeInfoPage.cshtml"
|
|
||||||
Write(Resources.RuntimeInfoPage_RuntimeVersion);
|
|
||||||
|
|
||||||
#line default
|
|
||||||
#line hidden
|
|
||||||
WriteLiteral(" ");
|
|
||||||
#line 33 "RuntimeInfoPage.cshtml"
|
|
||||||
Write(string.IsNullOrWhiteSpace(Model.Version) ? Resources.RuntimeInfoPage_RuntimeVersionFail : Model.Version);
|
|
||||||
|
|
||||||
#line default
|
|
||||||
#line hidden
|
|
||||||
WriteLiteral("</p>\r\n\r\n <p>");
|
|
||||||
#line 35 "RuntimeInfoPage.cshtml"
|
|
||||||
Write(Resources.RuntimeInfoPage_RuntimeArchitecture);
|
|
||||||
|
|
||||||
#line default
|
|
||||||
#line hidden
|
|
||||||
WriteLiteral(" ");
|
|
||||||
#line 35 "RuntimeInfoPage.cshtml"
|
|
||||||
Write(string.IsNullOrWhiteSpace(Model.RuntimeArchitecture) ? Resources.RuntimeInfoPage_RuntimeArchitectureFail : Model.RuntimeArchitecture);
|
|
||||||
|
|
||||||
#line default
|
|
||||||
#line hidden
|
|
||||||
WriteLiteral("</p>\r\n\r\n <p>");
|
|
||||||
#line 37 "RuntimeInfoPage.cshtml"
|
|
||||||
Write(Resources.RuntimeInfoPage_RuntimeType);
|
|
||||||
|
|
||||||
#line default
|
|
||||||
#line hidden
|
|
||||||
WriteLiteral(" ");
|
|
||||||
#line 37 "RuntimeInfoPage.cshtml"
|
|
||||||
Write(string.IsNullOrWhiteSpace(Model.RuntimeType) ? Resources.RuntimeInfoPage_RuntimeTypeFail : Model.RuntimeType);
|
|
||||||
|
|
||||||
#line default
|
|
||||||
#line hidden
|
|
||||||
WriteLiteral("</p>\r\n</body>\r\n</html>\r\n");
|
|
||||||
}
|
|
||||||
#pragma warning restore 1998
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,39 +0,0 @@
|
||||||
@using System
|
|
||||||
@using System.Globalization
|
|
||||||
@using System.Linq
|
|
||||||
@using Microsoft.AspNetCore.Diagnostics
|
|
||||||
@using Microsoft.AspNetCore.Diagnostics.Views
|
|
||||||
@using Microsoft.Extensions.PlatformAbstractions;
|
|
||||||
|
|
||||||
@functions
|
|
||||||
{
|
|
||||||
public RuntimeInfoPage(RuntimeInfoPageModel model)
|
|
||||||
{
|
|
||||||
Model = model;
|
|
||||||
}
|
|
||||||
|
|
||||||
public RuntimeInfoPageModel Model { get; set; }
|
|
||||||
}
|
|
||||||
@{
|
|
||||||
Response.ContentType = "text/html; charset=utf-8";
|
|
||||||
}
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="@CultureInfo.CurrentUICulture.TwoLetterISOLanguageName" xmlns="http://www.w3.org/1999/xhtml">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<title>@Resources.RuntimeInfoPage_Title</title>
|
|
||||||
<style>
|
|
||||||
<%$ include: RuntimeInfoPage.css % >
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h2>@Resources.RuntimeInfoPage_Environment</h2>
|
|
||||||
<p>@Resources.RuntimeInfoPage_OperatingSystem @(string.IsNullOrWhiteSpace(Model.OperatingSystem) ? Resources.RuntimeInfoPage_OperatingSystemFail : Model.OperatingSystem)</p>
|
|
||||||
|
|
||||||
<p>@Resources.RuntimeInfoPage_RuntimeVersion @(string.IsNullOrWhiteSpace(Model.Version) ? Resources.RuntimeInfoPage_RuntimeVersionFail : Model.Version)</p>
|
|
||||||
|
|
||||||
<p>@Resources.RuntimeInfoPage_RuntimeArchitecture @(string.IsNullOrWhiteSpace(Model.RuntimeArchitecture) ? Resources.RuntimeInfoPage_RuntimeArchitectureFail : Model.RuntimeArchitecture)</p>
|
|
||||||
|
|
||||||
<p>@Resources.RuntimeInfoPage_RuntimeType @(string.IsNullOrWhiteSpace(Model.RuntimeType) ? Resources.RuntimeInfoPage_RuntimeTypeFail : Model.RuntimeType)</p>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
||||||
body {
|
|
||||||
font-family: 'Segoe UI', Tahoma, Arial, Helvetica, sans-serif;
|
|
||||||
font-size: .813em;
|
|
||||||
line-height: 1.4em;
|
|
||||||
color: #222;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1, h2, h3, h4, h5, th {
|
|
||||||
font-weight: 100;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
color: #44525e;
|
|
||||||
margin: 15px 0 15px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
h2 {
|
|
||||||
margin: 10px 5px 0 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
table .even{
|
|
||||||
background-color: #f0f0f0;
|
|
||||||
}
|
|
||||||
|
|
||||||
th {
|
|
||||||
font-size: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Diagnostics.Views
|
|
||||||
{
|
|
||||||
public class RuntimeInfoPageModel
|
|
||||||
{
|
|
||||||
public string Version { get; internal set; }
|
|
||||||
|
|
||||||
public string OperatingSystem { get; internal set; }
|
|
||||||
|
|
||||||
public string RuntimeArchitecture { get; internal set; }
|
|
||||||
|
|
||||||
public string RuntimeType { get; internal set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -9,9 +9,8 @@
|
||||||
<ProjectGuid>b9f08060-621f-4e1f-bda8-9c4ea107e08a</ProjectGuid>
|
<ProjectGuid>b9f08060-621f-4e1f-bda8-9c4ea107e08a</ProjectGuid>
|
||||||
<RootNamespace>Microsoft.AspNetCore.DiagnosticsViewPage.Sources</RootNamespace>
|
<RootNamespace>Microsoft.AspNetCore.DiagnosticsViewPage.Sources</RootNamespace>
|
||||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
|
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
|
||||||
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
|
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
|
||||||
|
|
@ -1,38 +0,0 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
||||||
|
|
||||||
using System.Net;
|
|
||||||
using System.Net.Http;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Microsoft.Extensions.PlatformAbstractions;
|
|
||||||
using Xunit;
|
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Diagnostics.FunctionalTests
|
|
||||||
{
|
|
||||||
public class RuntimeInfoPageSampleTest : IClassFixture<TestFixture<RuntimeInfoPageSample.Startup>>
|
|
||||||
{
|
|
||||||
public RuntimeInfoPageSampleTest(TestFixture<RuntimeInfoPageSample.Startup> fixture)
|
|
||||||
{
|
|
||||||
Client = fixture.Client;
|
|
||||||
}
|
|
||||||
|
|
||||||
public HttpClient Client { get; }
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task RuntimeInfoPage_ShowsInfo()
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
var request = new HttpRequestMessage(HttpMethod.Get, "http://localhost/runtimeinfo");
|
|
||||||
|
|
||||||
// Act
|
|
||||||
var response = await Client.SendAsync(request);
|
|
||||||
|
|
||||||
var os = PlatformServices.Default.Runtime.OperatingSystem;
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
var body = await response.Content.ReadAsStringAsync();
|
|
||||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
|
||||||
Assert.Contains($"Operating System: {os}", body);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -10,16 +10,10 @@
|
||||||
"Microsoft.AspNetCore.TestHost": "1.0.0-*",
|
"Microsoft.AspNetCore.TestHost": "1.0.0-*",
|
||||||
"Microsoft.AspNetCore.Testing": "1.0.0-*",
|
"Microsoft.AspNetCore.Testing": "1.0.0-*",
|
||||||
"MiddlewareAnalysisSample": "1.0.0",
|
"MiddlewareAnalysisSample": "1.0.0",
|
||||||
"RuntimeInfoPageSample": "1.0.0",
|
|
||||||
"StatusCodePagesSample": "1.0.0",
|
"StatusCodePagesSample": "1.0.0",
|
||||||
"WelcomePageSample": "1.0.0",
|
"WelcomePageSample": "1.0.0",
|
||||||
"xunit": "2.1.0"
|
"xunit": "2.1.0"
|
||||||
},
|
},
|
||||||
"exclude": [
|
|
||||||
"wwwroot",
|
|
||||||
"node_modules",
|
|
||||||
"bower_components"
|
|
||||||
],
|
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
"netcoreapp1.0": {
|
"netcoreapp1.0": {
|
||||||
"imports": [
|
"imports": [
|
||||||
|
|
@ -40,9 +34,5 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"testRunner": "xunit",
|
"testRunner": "xunit",
|
||||||
"publishExclude": [
|
|
||||||
"**.user",
|
|
||||||
"**.vspscc"
|
|
||||||
],
|
|
||||||
"version": "1.0.0-*"
|
"version": "1.0.0-*"
|
||||||
}
|
}
|
||||||
|
|
@ -1,96 +0,0 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
||||||
|
|
||||||
using System.IO;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Microsoft.AspNetCore.Builder;
|
|
||||||
using Microsoft.AspNetCore.Http;
|
|
||||||
using Microsoft.Extensions.Options;
|
|
||||||
using Microsoft.Extensions.PlatformAbstractions;
|
|
||||||
using Moq;
|
|
||||||
using Xunit;
|
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Diagnostics.Tests
|
|
||||||
{
|
|
||||||
public class RuntimeInfoMiddlewareTest
|
|
||||||
{
|
|
||||||
private const string DefaultPath = "/runtimeinfo";
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void DefaultPageOptions_HasDefaultPath()
|
|
||||||
{
|
|
||||||
// Arrange & act
|
|
||||||
var options = new RuntimeInfoPageOptions();
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
Assert.Equal(DefaultPath, options.Path.Value);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async void Invoke_WithNonMatchingPath_IgnoresRequest()
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
RequestDelegate next = _ =>
|
|
||||||
{
|
|
||||||
return Task.FromResult<object>(null);
|
|
||||||
};
|
|
||||||
|
|
||||||
var middleware = new RuntimeInfoMiddleware(
|
|
||||||
next,
|
|
||||||
Options.Create(new RuntimeInfoPageOptions()));
|
|
||||||
|
|
||||||
var contextMock = new Mock<HttpContext>(MockBehavior.Strict);
|
|
||||||
contextMock
|
|
||||||
.SetupGet(c => c.Request.Path)
|
|
||||||
.Returns(new PathString("/nonmatchingpath"));
|
|
||||||
|
|
||||||
// Act
|
|
||||||
await middleware.Invoke(contextMock.Object);
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
contextMock.VerifyGet(c => c.Request.Path, Times.Once());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async void Invoke_WithMatchingPath_ReturnsInfoPage()
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
RequestDelegate next = _ =>
|
|
||||||
{
|
|
||||||
return Task.FromResult<object>(null);
|
|
||||||
};
|
|
||||||
var runtimeEnvironment = PlatformServices.Default.Runtime;
|
|
||||||
|
|
||||||
var middleware = new RuntimeInfoMiddleware(
|
|
||||||
next,
|
|
||||||
Options.Create(new RuntimeInfoPageOptions()));
|
|
||||||
|
|
||||||
var buffer = new byte[4096];
|
|
||||||
using (var responseStream = new MemoryStream(buffer))
|
|
||||||
{
|
|
||||||
var contextMock = new Mock<HttpContext>(MockBehavior.Strict);
|
|
||||||
contextMock
|
|
||||||
.SetupGet(c => c.Request.Path)
|
|
||||||
.Returns(new PathString("/runtimeinfo"));
|
|
||||||
contextMock
|
|
||||||
.SetupGet(c => c.Response.Body)
|
|
||||||
.Returns(responseStream);
|
|
||||||
contextMock
|
|
||||||
.SetupGet(c => c.RequestServices)
|
|
||||||
.Returns(() => null);
|
|
||||||
|
|
||||||
// Act
|
|
||||||
await middleware.Invoke(contextMock.Object);
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
var response = Encoding.UTF8.GetString(buffer);
|
|
||||||
|
|
||||||
Assert.Contains($"<p>Runtime Version: {runtimeEnvironment.RuntimeVersion}</p>", response);
|
|
||||||
Assert.Contains($"<p>Operating System: {runtimeEnvironment.OperatingSystem}</p>", response);
|
|
||||||
Assert.Contains($"<p>Runtime Architecture: {runtimeEnvironment.RuntimeArchitecture}</p>", response);
|
|
||||||
Assert.Contains($"<p>Runtime Type: {runtimeEnvironment.RuntimeType}</p>", response);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue