From d3a657402d2a8a324a9f3453dd052463b417d7cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Noco=C5=84?= Date: Sun, 23 Apr 2017 23:19:10 +0200 Subject: [PATCH] Add errors capturing, specify aspnet urls --- Dockerfile | 1 + src/Tn.DeviceManager.Web/Program.cs | 1 + src/Tn.DeviceManager.Web/Startup.cs | 17 ++--------------- 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/Dockerfile b/Dockerfile index 667a952..bd48edb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,6 +3,7 @@ FROM microsoft/dotnet:runtime LABEL maintainer "thom.nocon@gmail.com" EXPOSE 5000 +ENV ASPNETCORE_URLS="http://+:5000" WORKDIR /app COPY dist . diff --git a/src/Tn.DeviceManager.Web/Program.cs b/src/Tn.DeviceManager.Web/Program.cs index 2f56c73..7d81748 100644 --- a/src/Tn.DeviceManager.Web/Program.cs +++ b/src/Tn.DeviceManager.Web/Program.cs @@ -12,6 +12,7 @@ public static void Main(string[] args) var host = new WebHostBuilder() .UseKestrel() .UseContentRoot(Directory.GetCurrentDirectory()) + .CaptureStartupErrors(true) .UseIISIntegration() .UseStartup() .UseApplicationInsights() diff --git a/src/Tn.DeviceManager.Web/Startup.cs b/src/Tn.DeviceManager.Web/Startup.cs index 986f5fc..2b6f525 100644 --- a/src/Tn.DeviceManager.Web/Startup.cs +++ b/src/Tn.DeviceManager.Web/Startup.cs @@ -99,25 +99,12 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF private async Task StartServices(IApplicationBuilder app, IApplicationLifetime lifetime) { - try - { - await Task.WhenAll(app.ApplicationServices.GetServices().Select(lifecycle => lifecycle.Start())); - } - catch(Exception) - { - lifetime.StopApplication(); - } + await Task.WhenAll(app.ApplicationServices.GetServices().Select(lifecycle => lifecycle.Start())); } private async Task StopServices(IApplicationBuilder app) { - try - { - await Task.WhenAll(app.ApplicationServices.GetServices().Select(lifecycle => lifecycle.Stop())); - } - catch(Exception) - { - } + await Task.WhenAll(app.ApplicationServices.GetServices().Select(lifecycle => lifecycle.Stop())); } } }