@@ -27,79 +27,80 @@ public Startup(IAuthenticationSchemeProvider authSchemeProvider = null)
27
27
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
28
28
public void Configure ( IApplicationBuilder app )
29
29
{
30
- app . Run ( async ( context ) =>
31
- {
32
- context . Response . ContentType = "text/plain" ;
33
-
34
- await context . Response . WriteAsync ( "Hello World - " + DateTimeOffset . Now + Environment . NewLine ) ;
35
- await context . Response . WriteAsync ( Environment . NewLine ) ;
36
-
37
- await context . Response . WriteAsync ( "Address:" + Environment . NewLine ) ;
38
- await context . Response . WriteAsync ( "Scheme: " + context . Request . Scheme + Environment . NewLine ) ;
39
- await context . Response . WriteAsync ( "Host: " + context . Request . Headers [ "Host" ] + Environment . NewLine ) ;
40
- await context . Response . WriteAsync ( "PathBase: " + context . Request . PathBase . Value + Environment . NewLine ) ;
41
- await context . Response . WriteAsync ( "Path: " + context . Request . Path . Value + Environment . NewLine ) ;
42
- await context . Response . WriteAsync ( "Query: " + context . Request . QueryString . Value + Environment . NewLine ) ;
43
- await context . Response . WriteAsync ( Environment . NewLine ) ;
44
-
45
- await context . Response . WriteAsync ( "Connection:" + Environment . NewLine ) ;
46
- await context . Response . WriteAsync ( "RemoteIp: " + context . Connection . RemoteIpAddress + Environment . NewLine ) ;
47
- await context . Response . WriteAsync ( "RemotePort: " + context . Connection . RemotePort + Environment . NewLine ) ;
48
- await context . Response . WriteAsync ( "LocalIp: " + context . Connection . LocalIpAddress + Environment . NewLine ) ;
49
- await context . Response . WriteAsync ( "LocalPort: " + context . Connection . LocalPort + Environment . NewLine ) ;
50
- await context . Response . WriteAsync ( "ClientCert: " + context . Connection . ClientCertificate + Environment . NewLine ) ;
51
- await context . Response . WriteAsync ( Environment . NewLine ) ;
52
-
53
- await context . Response . WriteAsync ( "User: " + context . User . Identity . Name + Environment . NewLine ) ;
54
- if ( _authSchemeProvider != null )
55
- {
56
- var scheme = await _authSchemeProvider . GetSchemeAsync ( IISServerDefaults . AuthenticationScheme ) ;
57
- await context . Response . WriteAsync ( "DisplayName: " + scheme ? . DisplayName + Environment . NewLine ) ;
58
- }
59
-
60
- await context . Response . WriteAsync ( Environment . NewLine ) ;
61
-
62
- await context . Response . WriteAsync ( "Headers:" + Environment . NewLine ) ;
63
- foreach ( var header in context . Request . Headers )
64
- {
65
- await context . Response . WriteAsync ( header . Key + ": " + header . Value + Environment . NewLine ) ;
66
- }
67
- await context . Response . WriteAsync ( Environment . NewLine ) ;
68
-
69
- await context . Response . WriteAsync ( "Environment Variables:" + Environment . NewLine ) ;
70
- var vars = Environment . GetEnvironmentVariables ( ) ;
71
- foreach ( var key in vars . Keys . Cast < string > ( ) . OrderBy ( key => key , StringComparer . OrdinalIgnoreCase ) )
72
- {
73
- var value = vars [ key ] ;
74
- await context . Response . WriteAsync ( key + ": " + value + Environment . NewLine ) ;
75
- }
76
- await context . Response . WriteAsync ( Environment . NewLine ) ;
77
-
78
- // accessing IIS server variables
79
- await context . Response . WriteAsync ( "Server Variables:" + Environment . NewLine ) ;
80
-
81
- foreach ( var varName in IISServerVarNames )
82
- {
83
- await context . Response . WriteAsync ( varName + ": " + context . GetIISServerVariable ( varName ) + Environment . NewLine ) ;
84
- }
85
-
86
- await context . Response . WriteAsync ( Environment . NewLine ) ;
87
- if ( context . Features . Get < IHttpUpgradeFeature > ( ) != null )
88
- {
89
- await context . Response . WriteAsync ( "Websocket feature is enabled." ) ;
90
- }
91
- else
92
- {
93
- await context . Response . WriteAsync ( "Websocket feature is disabled." ) ;
94
- }
95
-
96
- await context . Response . WriteAsync ( Environment . NewLine ) ;
97
- var addresses = context . RequestServices . GetService < IServer > ( ) . Features . Get < IServerAddressesFeature > ( ) ;
98
- foreach ( var key in addresses . Addresses )
99
- {
100
- await context . Response . WriteAsync ( key + Environment . NewLine ) ;
101
- }
102
- } ) ;
30
+ throw new InvalidOperationException ( "Wow!" ) ;
31
+ //app.Run(async (context) =>
32
+ //{
33
+ // context.Response.ContentType = "text/plain";
34
+
35
+ // await context.Response.WriteAsync("Hello World - " + DateTimeOffset.Now + Environment.NewLine);
36
+ // await context.Response.WriteAsync(Environment.NewLine);
37
+
38
+ // await context.Response.WriteAsync("Address:" + Environment.NewLine);
39
+ // await context.Response.WriteAsync("Scheme: " + context.Request.Scheme + Environment.NewLine);
40
+ // await context.Response.WriteAsync("Host: " + context.Request.Headers["Host"] + Environment.NewLine);
41
+ // await context.Response.WriteAsync("PathBase: " + context.Request.PathBase.Value + Environment.NewLine);
42
+ // await context.Response.WriteAsync("Path: " + context.Request.Path.Value + Environment.NewLine);
43
+ // await context.Response.WriteAsync("Query: " + context.Request.QueryString.Value + Environment.NewLine);
44
+ // await context.Response.WriteAsync(Environment.NewLine);
45
+
46
+ // await context.Response.WriteAsync("Connection:" + Environment.NewLine);
47
+ // await context.Response.WriteAsync("RemoteIp: " + context.Connection.RemoteIpAddress + Environment.NewLine);
48
+ // await context.Response.WriteAsync("RemotePort: " + context.Connection.RemotePort + Environment.NewLine);
49
+ // await context.Response.WriteAsync("LocalIp: " + context.Connection.LocalIpAddress + Environment.NewLine);
50
+ // await context.Response.WriteAsync("LocalPort: " + context.Connection.LocalPort + Environment.NewLine);
51
+ // await context.Response.WriteAsync("ClientCert: " + context.Connection.ClientCertificate + Environment.NewLine);
52
+ // await context.Response.WriteAsync(Environment.NewLine);
53
+
54
+ // await context.Response.WriteAsync("User: " + context.User.Identity.Name + Environment.NewLine);
55
+ // if (_authSchemeProvider != null)
56
+ // {
57
+ // var scheme = await _authSchemeProvider.GetSchemeAsync(IISServerDefaults.AuthenticationScheme);
58
+ // await context.Response.WriteAsync("DisplayName: " + scheme?.DisplayName + Environment.NewLine);
59
+ // }
60
+
61
+ // await context.Response.WriteAsync(Environment.NewLine);
62
+
63
+ // await context.Response.WriteAsync("Headers:" + Environment.NewLine);
64
+ // foreach (var header in context.Request.Headers)
65
+ // {
66
+ // await context.Response.WriteAsync(header.Key + ": " + header.Value + Environment.NewLine);
67
+ // }
68
+ // await context.Response.WriteAsync(Environment.NewLine);
69
+
70
+ // await context.Response.WriteAsync("Environment Variables:" + Environment.NewLine);
71
+ // var vars = Environment.GetEnvironmentVariables();
72
+ // foreach (var key in vars.Keys.Cast<string>().OrderBy(key => key, StringComparer.OrdinalIgnoreCase))
73
+ // {
74
+ // var value = vars[key];
75
+ // await context.Response.WriteAsync(key + ": " + value + Environment.NewLine);
76
+ // }
77
+ // await context.Response.WriteAsync(Environment.NewLine);
78
+
79
+ // // accessing IIS server variables
80
+ // await context.Response.WriteAsync("Server Variables:" + Environment.NewLine);
81
+
82
+ // foreach (var varName in IISServerVarNames)
83
+ // {
84
+ // await context.Response.WriteAsync(varName + ": " + context.GetIISServerVariable(varName) + Environment.NewLine);
85
+ // }
86
+
87
+ // await context.Response.WriteAsync(Environment.NewLine);
88
+ // if (context.Features.Get<IHttpUpgradeFeature>() != null)
89
+ // {
90
+ // await context.Response.WriteAsync("Websocket feature is enabled.");
91
+ // }
92
+ // else
93
+ // {
94
+ // await context.Response.WriteAsync("Websocket feature is disabled.");
95
+ // }
96
+
97
+ // await context.Response.WriteAsync(Environment.NewLine);
98
+ // var addresses = context.RequestServices.GetService<IServer>().Features.Get<IServerAddressesFeature>();
99
+ // foreach (var key in addresses.Addresses)
100
+ // {
101
+ // await context.Response.WriteAsync(key + Environment.NewLine);
102
+ // }
103
+ //});
103
104
}
104
105
105
106
private static readonly string [ ] IISServerVarNames =
0 commit comments