appsettings.json file not found for .NET Core app hosted in Windows Service or InProcess IIS #116
Labels
bug
Something isn't working
good first issue
Good for newcomers
help wanted
Extra attention is needed
Milestone
Description
When using InProcess IIS hosting or Windows Service, the Agent looks for the appsettings.json using GetCurrentDirectory(). For InProcess IIS or a Windows Service, GetCurrentDirectory() returns the path of the IIS app pool process or - in the case of Windows Service -
C:\Windows\system32\
), not the path of the application.This is a known issue in AspNetCore.
This Issue is to change the Agent to use a different way to get to the appsettings.json file.
One alternative is suggested in the AspNetCore Issue.
Another alternative may be to use the
AppContext.BaseDirectory
property instead of GetCurrentDirectory().Expected Behavior
The Agent should find and use appsettings.json if it is located in the current working directory of the application.
Steps to Reproduce
Your Environment
.NET Core application, hosted in InProcess IIS or Windows Service.
Additional context
Workarounds:
<aspNetCore processPath="dotnet" arguments=".\MVCcore.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="OutOfProcess" />
Internal NR only: ref1 ref2 ref3
Note about development environment
N/A
The text was updated successfully, but these errors were encountered: