mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-23 09:18:55 +02:00
Fix code for .NET Core 2 so that server has cancellation token, and Stop method waits for shutdown. This resolves issues when using .NET Core 2 and starting/stopping server instances. (#145)
This commit is contained in:
@@ -110,7 +110,7 @@ namespace WireMock.Owin
|
|||||||
_host.Run(_cts.Token);
|
_host.Run(_cts.Token);
|
||||||
#else
|
#else
|
||||||
_logger.Info("WireMock.Net server using netstandard2.0");
|
_logger.Info("WireMock.Net server using netstandard2.0");
|
||||||
_host.Run();
|
_host.RunAsync(_cts.Token).Wait();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|||||||
@@ -248,7 +248,9 @@ namespace WireMock.Server
|
|||||||
[PublicAPI]
|
[PublicAPI]
|
||||||
public void Stop()
|
public void Stop()
|
||||||
{
|
{
|
||||||
_httpServer?.StopAsync();
|
var result = _httpServer?.StopAsync();
|
||||||
|
if (result != null)
|
||||||
|
result.Wait(); //wait for stop to actually happen
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user