// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IServiceProvider serviceProvider) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); app.UseDefaultFiles(); app.UseStaticFiles(); app.UseWebSockets(); app.Use(async(context, next) => { if (context.WebSockets.IsWebSocketRequest) { await ClientSocket.Create(context, serviceProvider.GetService <IApplicationRepository>()); } else { await next(); } }); //app.Use(async (context, next) => //{ // loggerFactory.CreateLogger("Unknown route").LogWarning(context.Request.Path); // context.Response.Redirect($"http://{context.Request.Host}"); // await Task.FromResult(false); //}); }