mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-02-22 08:47:51 +01:00
workaround for AppContext.BaseDirectory being null on some platforms (#293)
This commit is contained in:
committed by
Stef Heyenrath
parent
0ce26ab1a0
commit
55a0a6ee71
@@ -56,7 +56,18 @@ namespace WireMock.Owin
|
||||
|
||||
public Task StartAsync()
|
||||
{
|
||||
_host = new WebHostBuilder()
|
||||
var builder = new WebHostBuilder();
|
||||
|
||||
// Workaround for https://github.com/WireMock-Net/WireMock.Net/issues/292
|
||||
// On some platforms, AppContext.BaseDirectory is null, which causes WebHostBuilder to fail if ContentRoot is not
|
||||
// specified (even though we don't actually use that base path mechanism, since we have our own way of configuring
|
||||
// a filesystem handler).
|
||||
if (string.IsNullOrEmpty(AppContext.BaseDirectory))
|
||||
{
|
||||
builder.UseContentRoot(System.IO.Directory.GetCurrentDirectory());
|
||||
}
|
||||
|
||||
_host = builder
|
||||
.ConfigureServices(services =>
|
||||
{
|
||||
services.AddSingleton(_options.FileSystemHandler);
|
||||
|
||||
Reference in New Issue
Block a user