- Notifications
You must be signed in to change notification settings - Fork 1.4k
/
Copy pathProgram.cs
46 lines (39 loc) · 2.33 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
usingMicrosoft.AspNetCore.Hosting;
usingMicrosoft.AspNetCore.Builder;
usingMicrosoft.AspNetCore.Http;
usingMicrosoft.AspNetCore;
usingMicrosoft.Extensions.Hosting;
usingSystem;
usingSystem.Runtime.InteropServices;
usingSystem.Reflection;
varapp=WebApplication.Create();
app.Run(async context =>
{
context.Response.Headers["Content-Type"]="text/html";
awaitcontext.Response.WriteAsync("<html><body>");
awaitcontext.Response.WriteAsync("<h1>.NET Core Info</h1>");
awaitcontext.Response.WriteAsync($"Environment.Version: {Environment.Version}");
awaitcontext.Response.WriteAsync("<br/>");
awaitcontext.Response.WriteAsync($"RuntimeInformation.FrameworkDescription: {RuntimeInformation.FrameworkDescription}");
awaitcontext.Response.WriteAsync("<br/>");
varcoreCLR=((AssemblyInformationalVersionAttribute[])typeof(object).Assembly.GetCustomAttributes(typeof(AssemblyInformationalVersionAttribute),false))[0].InformationalVersion;
awaitcontext.Response.WriteAsync($"CoreCLR Build: {coreCLR.Split('+')[0]}");
awaitcontext.Response.WriteAsync("<br/>");
awaitcontext.Response.WriteAsync($"CoreCLR Hash: {coreCLR.Split('+')[1]}");
awaitcontext.Response.WriteAsync("<br/>");
varcoreFX=((AssemblyInformationalVersionAttribute[])typeof(Uri).Assembly.GetCustomAttributes(typeof(AssemblyInformationalVersionAttribute),false))[0].InformationalVersion;
awaitcontext.Response.WriteAsync($"CoreFX Build: {coreFX.Split('+')[0]}");
awaitcontext.Response.WriteAsync("<br/>");
awaitcontext.Response.WriteAsync($"CoreFX Hash: {coreFX.Split('+')[1]}");
awaitcontext.Response.WriteAsync("<br/>");
awaitcontext.Response.WriteAsync("<h2>Environment info</h2>");
awaitcontext.Response.WriteAsync($"Environment.OSVersion: {Environment.OSVersion}");
awaitcontext.Response.WriteAsync("<br/>");
awaitcontext.Response.WriteAsync($"RuntimeInformation.OSDescription: {RuntimeInformation.OSDescription}");
awaitcontext.Response.WriteAsync("<br/>");
awaitcontext.Response.WriteAsync($"RuntimeInformation.OSArchitecture: {RuntimeInformation.OSArchitecture}");
awaitcontext.Response.WriteAsync("<br/>");
awaitcontext.Response.WriteAsync($"Environment.ProcessorCount: {Environment.ProcessorCount}");
awaitcontext.Response.WriteAsync("</body></html>");
});
app.Run();