appsettings.Production.json holds settings specific to an ASP.NET Core production environment. It overrides corresponding values in appsettings.json, which supplies the defaults. Development settings can instead come from appsettings.Development.json and a developer’s private secrets.json. section 12.1.4 section 12.3.7
Create the production file on the server during deployment, not in the shared Visual Studio project. Keeping it out of the project reduces the risk of private settings reaching a public repository or an unprotected device. section 12.1.4
For the MyBGList API deployed to a Windows VM:
- Create the production database, including the login and user needed by its connection string. Give the production login a different password from the development login. section 12.3.6
- On the VM, create appsettings.Production.json in C:\inetpub\MyBGList, the IIS website’s physical directory where the API artifacts are deployed. section 12.3.7
- Use the keys from the local secrets.json as a starting point. Replace ConnectionStrings:DefaultConnection with values for the production database, including its production credentials. section 12.3.7
- Save the file and check that its name ends in .json, not .json.txt—a possible mistake when using Notepad. section 12.3.7
The sample setup leaves the Azure Application Insights connection string and Redis configuration unchanged for simplicity. If those services are used, give development and production separate instances rather than treating the sample values as a production plan. section 12.3.7
