Azure Application Settings not overriding my appsettings.json file values

前端 未结 2 1479
耶瑟儿~
耶瑟儿~ 2020-12-15 17:23

I have tried adding DefaultConnection from my appsettings.json file to Azure\'s Application Settings but Azure will not override the connection string.

2条回答
  •  甜味超标
    2020-12-15 18:07

    I just had a similar problem (the problem was with PostgreSQL connection string type, I had to change it to custom) and now it works for me, so these are the pieces:

    1. This is my appsettings.json file. I have a value for 'Psql' set in my appsettings.Development.json, but in the appsettings.json it is left empty.
    2. These are the settings which are set in the Azure portal. Please note, that there are two ways to override the connection string.
    3. This is the part of my Startup.cs file. Pay attention to the order of how the settings are applied in the Startup constructor and the way I get the connection string in the ConfigureServices method (GetConnectionString is a standard extension method).

    Additional info from my comments below:

    Azure GUI (Connection strings, Application settings) uses environment variables internally, so the appsettings.json will stay the same.

    If there is a need for an appsettings.json's value to be overwritten during VSTS release activity (before it will be published to Azure), Colin's ALM Corner Build & Release Tools can be used. Here are the links to Colin's ALM Corner Build & Release Tools and tutorial.

提交回复
热议问题