Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Publish appsettings.production.json onto azure

I have an asp.net core 1.0.0 app in VS 2015 Update 3 with two appsettings-- appsettings.Development.json and appsettings.Production.json. I'm trying to use VS to publish my app into Azure and I need for it to use the configuration in appsettings.Production.json. However I can't seem to get it working. It doesn't even seem to use the development json-- just the base appsettings.json which doesn't have anything.

So how do I get the VS publishing to work in Azure using the appsettings.Production.json configuration?

like image 727
Los Morales Avatar asked Jul 12 '16 14:07

Los Morales


People also ask

How do I use publish settings for Azure App service?

You can use the Publish tool to import publish settings and then deploy your app. In this article, we use publish settings for Azure App Service. These steps apply to ASP.NET and ASP.NET Core web apps. You can also import publish settings for Python apps.

How do I set environment variables in Azure App service?

For Linux apps and custom containers, App Service passes app settings to the container using the --env flag to set the environment variable in the container. In the Azure portal, navigate to your app's management page. In the app's left menu, click Configuration > Application settings.

How do I change the default settings in Azure App services?

Configure general settings In the Azure portal, search for and select App Services, and then select your app. In the app's left menu, select Configuration > General settings. Here, you can configure some common settings for the app.

Where does the appsettings JSON file go?

The appsettings.json file goes into the wwwroot/bin folder and the functions are not able to access it. I thought that maybe if I changed functions project to have a folder structure it would deploy the appsettings.json, I changed it to the following


2 Answers

Have a look at the following blog post:

http://asp.net-hacker.rocks/2016/03/21/configure-aspnetcore.html

It talks about using environment specific configurations. It appears that the concepts of transforms was not brought over yet.

like image 90
Justin Patten Avatar answered Sep 23 '22 12:09

Justin Patten


In project.json, ensure that publishOptions/include contains appsettings.Production.json.

like image 38
Edward Brey Avatar answered Sep 20 '22 12:09

Edward Brey