Skip to content

Commit

Permalink
Add errors capturing, specify aspnet urls
Browse files Browse the repository at this point in the history
  • Loading branch information
tomnocon committed Apr 23, 2017
1 parent 1edf612 commit d3a6574
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 15 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 .

Expand Down
1 change: 1 addition & 0 deletions src/Tn.DeviceManager.Web/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public static void Main(string[] args)
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.CaptureStartupErrors(true)
.UseIISIntegration()
.UseStartup<Startup>()
.UseApplicationInsights()
Expand Down
17 changes: 2 additions & 15 deletions src/Tn.DeviceManager.Web/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<ILifecycle>().Select(lifecycle => lifecycle.Start()));
}
catch(Exception)
{
lifetime.StopApplication();
}
await Task.WhenAll(app.ApplicationServices.GetServices<ILifecycle>().Select(lifecycle => lifecycle.Start()));
}

private async Task StopServices(IApplicationBuilder app)
{
try
{
await Task.WhenAll(app.ApplicationServices.GetServices<ILifecycle>().Select(lifecycle => lifecycle.Stop()));
}
catch(Exception)
{
}
await Task.WhenAll(app.ApplicationServices.GetServices<ILifecycle>().Select(lifecycle => lifecycle.Stop()));
}
}
}

0 comments on commit d3a6574

Please sign in to comment.