Fixed issue 223: Example for WireMock as Windows Service throws Exception because of WireMockConsoleLogger

This commit is contained in:
Paul, Alexander
2018-11-06 09:15:54 +01:00
parent 9ff19b0737
commit 2f91f85fa8

View File

@@ -21,7 +21,7 @@ namespace Wiremock.Net.Service
protected override void OnStart(string[] args) protected override void OnStart(string[] args)
{ {
Start(); Start(new WireMockNullLogger());
} }
protected override void OnStop() protected override void OnStop()
@@ -46,7 +46,7 @@ namespace Wiremock.Net.Service
else else
{ {
// running as console app // running as console app
Start(); Start(new WireMockConsoleLogger());
Console.WriteLine("Press any key to stop..."); Console.WriteLine("Press any key to stop...");
Console.ReadKey(true); Console.ReadKey(true);
@@ -55,14 +55,14 @@ namespace Wiremock.Net.Service
} }
} }
private static void Start() private static void Start(IWireMockLogger logger)
{ {
_server = StandAloneApp.Start(new FluentMockServerSettings _server = StandAloneApp.Start(new FluentMockServerSettings
{ {
Urls = new[] { "http://*:9091/" }, Urls = new[] { "http://*:9091/" },
StartAdminInterface = true, StartAdminInterface = true,
ReadStaticMappings = true, ReadStaticMappings = true,
Logger = new WireMockConsoleLogger() Logger = logger
}); });
} }