Configurationmanager.Appsettings returning different values in different environments

Asked

Viewed 187 times

2

I don’t know much to post to help the question, so if you want to know more just mention the comments.

In the web.config, inside appSettings, has the tag <add key="apiManagerUrl" value="http://minha-api.azurewebsites.net/api/" />.
Running local it returns what is in value, but when I publish in the Azure service it is returning a random link: https://microsoft-apiapp37dce4952f834c67996305734fc0303e.azurewebsites.net/api/.

I know that the web.config is being updated when I publish the service because I needed to change the tag customErrors to identify the problem.
Both the apiManagerUrl how much service you need to call it are published in Azure.

  • Azure has a web.config type in the site’s control panel,try to set it up. I had the same problem, only my problem was with the string Connection

1 answer

2


Inside your Webapp, in the "Appsettings" option, you will find not only settings pertaining to the hosting, but version of . NET Framework, as well as some transformations that your web.config should undergo after being published.

inserir a descrição da imagem aqui

And that’s really cool! Because you can, and should, locally maintain the settings so that your application, at development time, is configured for your local/dev environments. And, when publishing, it will automatically point to the respective destinations as, if it is a test environment, it will transform your web.config to your Apis, or test databases. And the same if published then in production.

This way it will not happen if you forget to change the settings before going up an application.

  • That’s exactly what it was, thank you! Taking advantage of the answer, what is the option for Slot setting?

  • @Danieldutra, as it is another matter, put another question that I answer there for you. ;)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.