Reputation: 463
Our project is in sitecore and using Azure - App service for deployment. We have created staging slot and apart from application setting and connection string want to make some configuration file slot specific(stick to slot while swapping).
Is there a way to make whole configuration file to stick to a particular slot?
We also tried to write some sitecore configuration in app setting option in azure and ticked it to make it stick to slot but still it is getting swapped.
Please help me on this.
Upvotes: 1
Views: 746
Reputation: 7544
Is there a way to make whole configuration file to stick to a particular slot?
No, it is not possible (as of date of writing this answer, as azure is evolving all the time).
Here you can see details of slot swap procedure. My rewriting:
So basically slot setting is really specific feature; other than that slots are just separate sites, with different host names, ftp shares etc.
Any logic like "I want to have file sticked to slot" should be implemented in some custom way.
For example you can consider using config transforms (you can use this question as a start).
Upvotes: 1
Reputation: 4319
Alternatively, you can add AppSettings into the Azure Portal's Application Settings and have those setting stick to the slot. These settings will override whatever is in the web.config. For example, if you have an Azure Portal AppSetting of key "Greeting" and value of "Welcome", and the web.config has the same AppSetting with value of "Hello" - the result will be "Welcome". If there is an AppSetting in the web.config that is not in the Azure settings, then it will use the web.config value.
Upvotes: 0
Reputation: 1346
In the Azure portal you can add AppSettings and mark them as "Slot Specific". These can be read from the application using normal System.Configuration.ConfigurationManager.AppSettings semantics.
There's no way to ask Azure programmatically which slot the app is running in to my knowledge.
Upvotes: 0