Published .Net Core 2 application does not read appsettings.json file

蓝咒 提交于 2019-12-02 09:04:36

The problem is the path i was running the application from.

I was running the command to start the app from the root (/). Application was running fine but obviously couldn't locate the appsettings.json file.

I tried to start the app from the Project path so i cd'ed into the Project directory, ran the command and everything went back to normal.


Detailed explanation here:

When i was running those apps i've been mentioning above, i used to cd into their directories and execute "dotnet run".

cd /blabla/etcetc
dotnet run

However, after i publish them, i couldn't use the same command. I had to specify it's dll. Then i figured, i could just run them without cd-ing into their directories.

dotnet /blabla/etcetc/my.project.dll

And that was the problem. Instead of doing so, now i'm doing this;

cd /blabla/etcetc
dotnet my.project.dll
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!