Matt
October 16, 2018, 10:58am
1
I have the following configuration item with a dot net core service
options.Listen(IPAddress.Loopback, 9010, listenOptions =>
{
listenOptions.UseHttps("cert.pfx", "xxxx");
});
It complains that the file is not found, however the file does exist in the output folder.
Any thoughts ?
Matt
October 16, 2018, 11:00am
2
It appears that Environment.CurrentDirectory points to the root service folder not the bin\debug… folder I was expecting.
Matt
October 17, 2018, 1:31am
3
Found this discussion
opened 10:19PM - 11 Oct 16 UTC
closed 02:58PM - 27 Oct 16 UTC
Bug
1) Create a netcore console app and replace Main with this:
``` csharp
Conso… le.WriteLine(Directory.GetCurrentDirectory());
```
2) Ctrl+F5
Expected something like this:
C:\ConsoleApplication1\ConsoleApplication1\bin\Debug
Got this:
C:\ConsoleApplication1\ConsoleApplication1
Issue is due to some ASP.NET constraint which breaks for console applications. Workaround is to use something like this to get the path rather than rely on Current directory to be the bin folder.
Path.GetDirectoryName(Assembly.GetEntryAssembly().Location
1 Like