How to generate the appsettings..json file?











up vote
0
down vote

favorite












I have an asp.net core 2 web api which will be deployed across the following environments:



INT, QA, STAGE, PRODUCTION environments.



Based on the above, I need to have appsettings.<EnvironmentName>.json file for each environment. From the link : https://docs.microsoft.com/en-us/aspnet/core/fundamentals/environments?view=aspnetcore-2.1 , I see that



In case of local development environment, the Environment Variable called ASPNETCORE_ENVIRONMENT is set to Development. In case of the deployment where ASPNETCORE_ENVIRONMENT is not set, the default is Production



I would like to know what are the steps required to take care while preparing the appsettings.<EnvironmentName>.json file for INT, QA and STAGE environment. Do I need to set the environment explicitly for each environment web server:



set ASPNETCORE_ENVIRONMENT=Development.



Can anyone help me to by providing their guidance?










share|improve this question


























    up vote
    0
    down vote

    favorite












    I have an asp.net core 2 web api which will be deployed across the following environments:



    INT, QA, STAGE, PRODUCTION environments.



    Based on the above, I need to have appsettings.<EnvironmentName>.json file for each environment. From the link : https://docs.microsoft.com/en-us/aspnet/core/fundamentals/environments?view=aspnetcore-2.1 , I see that



    In case of local development environment, the Environment Variable called ASPNETCORE_ENVIRONMENT is set to Development. In case of the deployment where ASPNETCORE_ENVIRONMENT is not set, the default is Production



    I would like to know what are the steps required to take care while preparing the appsettings.<EnvironmentName>.json file for INT, QA and STAGE environment. Do I need to set the environment explicitly for each environment web server:



    set ASPNETCORE_ENVIRONMENT=Development.



    Can anyone help me to by providing their guidance?










    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I have an asp.net core 2 web api which will be deployed across the following environments:



      INT, QA, STAGE, PRODUCTION environments.



      Based on the above, I need to have appsettings.<EnvironmentName>.json file for each environment. From the link : https://docs.microsoft.com/en-us/aspnet/core/fundamentals/environments?view=aspnetcore-2.1 , I see that



      In case of local development environment, the Environment Variable called ASPNETCORE_ENVIRONMENT is set to Development. In case of the deployment where ASPNETCORE_ENVIRONMENT is not set, the default is Production



      I would like to know what are the steps required to take care while preparing the appsettings.<EnvironmentName>.json file for INT, QA and STAGE environment. Do I need to set the environment explicitly for each environment web server:



      set ASPNETCORE_ENVIRONMENT=Development.



      Can anyone help me to by providing their guidance?










      share|improve this question













      I have an asp.net core 2 web api which will be deployed across the following environments:



      INT, QA, STAGE, PRODUCTION environments.



      Based on the above, I need to have appsettings.<EnvironmentName>.json file for each environment. From the link : https://docs.microsoft.com/en-us/aspnet/core/fundamentals/environments?view=aspnetcore-2.1 , I see that



      In case of local development environment, the Environment Variable called ASPNETCORE_ENVIRONMENT is set to Development. In case of the deployment where ASPNETCORE_ENVIRONMENT is not set, the default is Production



      I would like to know what are the steps required to take care while preparing the appsettings.<EnvironmentName>.json file for INT, QA and STAGE environment. Do I need to set the environment explicitly for each environment web server:



      set ASPNETCORE_ENVIRONMENT=Development.



      Can anyone help me to by providing their guidance?







      c# asp.net-core-2.1 asp.net-core-webapi-2.1






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 5 at 19:39









      santosh kumar patro

      1,76772654




      1,76772654
























          2 Answers
          2






          active

          oldest

          votes

















          up vote
          1
          down vote













          I might be missing something, but this seems pretty straight-forward. To create the environment-specific setting files, you literally just create them in your project, i.e. create a new file called appsettings.Foo.json in the root of your project. Visual Studio will automatically put it under appsettings.json as a parent in the Solution Explorer.



          On the server, yes, you'd need to set the environment you want to run under to ASPNETCORE_ENVIRONMENT. If it's supposed to use appsettings.QA.json, then set it to QA. That's all there is to it.






          share|improve this answer




























            up vote
            0
            down vote













            You will have to set the ASPNETCORE_ENVIRONMENT on the server with the configuration you wish to host the app.



            Take a look at the sample project provided by Microsoft on Github



            Sample Environment project






            share|improve this answer





















              Your Answer






              StackExchange.ifUsing("editor", function () {
              StackExchange.using("externalEditor", function () {
              StackExchange.using("snippets", function () {
              StackExchange.snippets.init();
              });
              });
              }, "code-snippets");

              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "1"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














               

              draft saved


              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53161103%2fhow-to-generate-the-appsettings-environmentname-json-file%23new-answer', 'question_page');
              }
              );

              Post as a guest
































              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes








              up vote
              1
              down vote













              I might be missing something, but this seems pretty straight-forward. To create the environment-specific setting files, you literally just create them in your project, i.e. create a new file called appsettings.Foo.json in the root of your project. Visual Studio will automatically put it under appsettings.json as a parent in the Solution Explorer.



              On the server, yes, you'd need to set the environment you want to run under to ASPNETCORE_ENVIRONMENT. If it's supposed to use appsettings.QA.json, then set it to QA. That's all there is to it.






              share|improve this answer

























                up vote
                1
                down vote













                I might be missing something, but this seems pretty straight-forward. To create the environment-specific setting files, you literally just create them in your project, i.e. create a new file called appsettings.Foo.json in the root of your project. Visual Studio will automatically put it under appsettings.json as a parent in the Solution Explorer.



                On the server, yes, you'd need to set the environment you want to run under to ASPNETCORE_ENVIRONMENT. If it's supposed to use appsettings.QA.json, then set it to QA. That's all there is to it.






                share|improve this answer























                  up vote
                  1
                  down vote










                  up vote
                  1
                  down vote









                  I might be missing something, but this seems pretty straight-forward. To create the environment-specific setting files, you literally just create them in your project, i.e. create a new file called appsettings.Foo.json in the root of your project. Visual Studio will automatically put it under appsettings.json as a parent in the Solution Explorer.



                  On the server, yes, you'd need to set the environment you want to run under to ASPNETCORE_ENVIRONMENT. If it's supposed to use appsettings.QA.json, then set it to QA. That's all there is to it.






                  share|improve this answer












                  I might be missing something, but this seems pretty straight-forward. To create the environment-specific setting files, you literally just create them in your project, i.e. create a new file called appsettings.Foo.json in the root of your project. Visual Studio will automatically put it under appsettings.json as a parent in the Solution Explorer.



                  On the server, yes, you'd need to set the environment you want to run under to ASPNETCORE_ENVIRONMENT. If it's supposed to use appsettings.QA.json, then set it to QA. That's all there is to it.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 5 at 20:24









                  Chris Pratt

                  149k20229294




                  149k20229294
























                      up vote
                      0
                      down vote













                      You will have to set the ASPNETCORE_ENVIRONMENT on the server with the configuration you wish to host the app.



                      Take a look at the sample project provided by Microsoft on Github



                      Sample Environment project






                      share|improve this answer

























                        up vote
                        0
                        down vote













                        You will have to set the ASPNETCORE_ENVIRONMENT on the server with the configuration you wish to host the app.



                        Take a look at the sample project provided by Microsoft on Github



                        Sample Environment project






                        share|improve this answer























                          up vote
                          0
                          down vote










                          up vote
                          0
                          down vote









                          You will have to set the ASPNETCORE_ENVIRONMENT on the server with the configuration you wish to host the app.



                          Take a look at the sample project provided by Microsoft on Github



                          Sample Environment project






                          share|improve this answer












                          You will have to set the ASPNETCORE_ENVIRONMENT on the server with the configuration you wish to host the app.



                          Take a look at the sample project provided by Microsoft on Github



                          Sample Environment project







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Nov 5 at 21:33









                          codingpirate

                          9161819




                          9161819






























                               

                              draft saved


                              draft discarded



















































                               


                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53161103%2fhow-to-generate-the-appsettings-environmentname-json-file%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest




















































































                              這個網誌中的熱門文章

                              Academy of Television Arts & Sciences

                              L'Équipe

                              1995 France bombings