ThreeMammals / Ocelot

.NET API Gateway
https://www.nuget.org/packages/Ocelot
MIT License
8.38k stars 1.64k forks source link

AddOcelot writes to wrong directory with IIS and InProcess hostingModel #783

Closed stefankip closed 5 years ago

stefankip commented 5 years ago

I've recently updated a ASP.NET Core project to v2.2.1 and I'm using IIS with the hostingModel set to InProcess. The problem is with the AddOcelot method, to be precise this line: File.WriteAllText("ocelot.json", json); (https://github.com/EdwinVW/Ocelot/blob/develop/src/Ocelot/DependencyInjection/ConfigurationBuilderExtensions.cs#L72) The CurrentDirectory is set to the inetserv folder, instead of the application's root path. Despite the call to SetBasePath(hostingContext.HostingEnvironment.ContentRootPath).

So for now I'm setting the CurrentDirectory manually before calling AddOcelot, but it looks to me like a bigger issue?

Ocelot v13.0.0

jmezach commented 5 years ago

This is probably related to aspnet/AspNetCore#4206 which was fixed with ASP.NET Core 2.2.2.

stefankip commented 5 years ago

Yes you're right. Meanwhile I was already using v2.2.2 and I removed the manual call to set the current directory and everything's fine. Thanks!