mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 22:30:41 +01: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);
|
||||
#else
|
||||
_logger.Info("WireMock.Net server using netstandard2.0");
|
||||
_host.Run();
|
||||
_host.RunAsync(_cts.Token).Wait();
|
||||
#endif
|
||||
}
|
||||
catch (Exception e)
|
||||
|
||||
@@ -248,7 +248,9 @@ namespace WireMock.Server
|
||||
[PublicAPI]
|
||||
public void Stop()
|
||||
{
|
||||
_httpServer?.StopAsync();
|
||||
var result = _httpServer?.StopAsync();
|
||||
if (result != null)
|
||||
result.Wait(); //wait for stop to actually happen
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
Reference in New Issue
Block a user