Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
373 views
in Technique[技术] by (71.8m points)

c# - ASP.NET Core app - deploy as staging and read appsettings.staging

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...