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?
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.
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.
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.
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
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.
In project.json
, ensure that publishOptions/include
contains appsettings.Production.json
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With