Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
365 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 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...