Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Umbraco v9 has four appsettings.json files in the root directory:
When connecting to the Development database, does the ConnectionStrings go in appsettings.json or appsettings.Development.json please?
If you put the connection to the Production server in appsettings.Production.json does that automatically end up in the appsettings.json file in bin\Release\ after running dotnet publish --configuration Release" please?
the appsettings.*.json files are actually merged together at runtime. So for example when you are running development, the settings in appsettings.development.json are merged over the settings in appsettings.json (so the settings from development will overwrite)
when you run 'production' or 'staging' then those values are taken from the other files.
which environment you are in is determined by the value of the ASPNETCORE_ENVIRONMENT variable (see https://docs.microsoft.com/en-us/aspnet/core/fundamentals/environments?view=aspnetcore-6.0 ).
By default in development this value is set from your properties/launchsettings.json file, so for example when you are running locally from dotnet run (or in visual studio) it will be set to `development'.
When you publish all these different environmental files are actually copied into the publish directory, which one your site then uses depends on the setting of the variable by your environment, so for example you could set ASPNETCORE_ENVIRONMENT` to production or stage as part of your deployment to azure, and then the relevant file will be used when the site runs.
n.b Production is the default if nothing is set
The shorter answer for what you are asking, if during your development you use a local db put that in appsettings.development.json for live / stage you would put it in the relevent file, and set the environmental variable on the site when it runs.
Info on the environmental variable setup
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted