Problem setting up a slot for Azure App Services

I better understand the application settings for Slot for Azure App Services. When they are applied and how to use them correctly.

I have 2 App Services, each of which runs 2 slots, as shown below.

  • Site 1 with the placement of slots.
  • Site 1 with the placement of slots

  • Site 2 with slot-construction-production

  • Site 2 with a slot - production

So, for each site, I would like to be able to set an invalid connection string for the assembly slot in the application settings click so that the site could not be accessed, and just give you basically an error page on azuerwebsites.net for this slot.

In my working slot for each of them, I want to put the correct connection string so that they will work after replacing them.

I can not get this to work reliably, the settings are not applied during the exchange. Should I mark connection strings in the production slot as slot settings? Should the source in the build slot be the slot setup? I need some kind of nuget package that I don't know.

Please, help

+5
source share
2 answers

The answer to my question was found in this document. (What if someone from the Azure team arrives to meet should really be associated with the "Deployment Configuration" section here )

Windows Azure Websites: How Application Strings and Connection Strings Work

In short, you should not use ConfigurationManager to get settings from a click on application settings IF you are using the .NET 4.5 framework.

If you are not using the .NET 4.5 framework, you should use the Environment.GetEnvironmentVariable .

This worked when I converted my existing environment to App Services. I would really like to warn that I was convinced of it.

EDIT: So that was not the whole story,

The other part is what is meant by the β€œsticky” and β€œnon-sticky” settings in the documentation. I continued to find links to the fact that the settings were not actually placed in your web.config file, but rather they lived in a properties bag in the memory available to your application. I could not find any reference to how I could see what was in this mysterious bag, but the answer is obvious when you know it.

During swap, any settings in your intermediate slot are actually copied to the settings of your production slot, i.e. actually change it in the slots "Application Settings" in the production slots. And all that is in your slot. The app settings locator is what’s in the memory properties bag.

+2
source

If I understand your question correctly, you need to mark everything as the slot settings.

Application settings and connection strings marked as slot parameters will remain in the slot during swap execution. Any settings / connection strings that are not marked as slot parameters will be replaced by the application.

+5
source

All Articles