简体   繁体   中英

Moving a complex IIS web site to Azure Web app using deployment slots

We have quite a large and complex IIS web applications that are the combination of 3 websites, some wcf services and some MVC REST services all running under the same IIS web site.

As you can imagine, the web sites call the web services and the web services call other web services. On prem, this can be either configured to call services on localhost, or to a fully qualified domain.

I an Azure web app I don't think there is such a thing as locahost, so would need to use the fully qualified domain. This works ok.

However when it comes to deployment slots, how would this work? The deployment slot has a different URL, so how would we go about configuring the web service calls in the web.config? Do we have to deploy them with the "staging slot" configured, then change all the web.configs over to the live site just before swapping?

Any ideas would be appreciated.

As Jason P said in his comment : create the URL's as App Settings, and have them be slot specific. This means the settings will stick to the slot they're defined for.

When you clone configuration from another deployment slot, the cloned configuration is editable. Furthermore, some configuration elements follow the content across a swap (not slot specific) while other configuration elements stay in the same slot after a swap (slot specific).

To configure an app setting or connection string to stick to a specific slot (not swapped), navigate to the Application settings page for that slot, then select the Slot Setting box for the configuration elements that should stick to the slot. Marking a configuration element as slot specific tells App Service that it's not swappable.
插槽设置

Source: Set up staging environments in Azure App Service - Which settings are swapped?

EDIT:

That would require changing the code so all service calls use a slot setting rather than the web.config.

This is not true . Any setting that's in Application Settings overrides the setting with the same name in the web.config. This is also true for slot settings.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM