I publish an ASP.NET Core 3.1 project to my VM wwwroot>whatever
and remove all the appsettings.json
files except for appsettings.production.json
It accepts that file, runs properly and reads the settings inside of it (connection string etc.) with no issues.
When I tried to do the same for the same project, hosted on the same machine, using a different AppPool etc. it doesn't accept the respective appsettings.staging.json
file - I have to rename it as just appsettings.json
for it to work.
Why is this?
It's an issue because I'm trying to use Microsoft.AspNetCore.Hosting.IWebHostEnvironment
in the app and I'm unsure how to publish the project as a "staging" release. I figured if I just left the appsettings.staging.json
file in there only, that would do it, but I think I'm sorely mistaken.
question from:
https://stackoverflow.com/questions/65941187/asp-net-core-app-deploy-as-staging-and-read-appsettings-staging 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…