From 5ccb99220116185d1cb6fd8cccd5e1075f996ebe Mon Sep 17 00:00:00 2001 From: davide-romanini Date: Sun, 2 Sep 2018 21:42:57 +0200 Subject: [PATCH] 196 fix: set IsStarted = true in a IApplicationLifetime.ApplicationStarted listener (#197) --- src/WireMock.Net/Owin/AspNetCoreSelfHost.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/WireMock.Net/Owin/AspNetCoreSelfHost.cs b/src/WireMock.Net/Owin/AspNetCoreSelfHost.cs index 524600fd..098a7fdf 100644 --- a/src/WireMock.Net/Owin/AspNetCoreSelfHost.cs +++ b/src/WireMock.Net/Owin/AspNetCoreSelfHost.cs @@ -104,7 +104,9 @@ namespace WireMock.Owin { try { - IsStarted = true; + var appLifetime = (IApplicationLifetime) _host.Services.GetService(typeof(IApplicationLifetime)); + appLifetime.ApplicationStarted.Register(() => IsStarted = true); + #if NETSTANDARD1_3 _logger.Info("WireMock.Net server using netstandard1.3"); #elif NETSTANDARD2_0