Events that fire when a placement of a hosted service deployment slot (Swap VIP) changes

I have several settings in my applications that rely on a deployment slot. I understand the penalties and consequences that such a design decision makes, but the decision is final and works for our business.

What I would like to know is , what events are triggered when the hosted service of the Deployment Slot changes (if any)? RoleEnvironmentTopologyChange looked right, but the decryption says it fires when the number of instances changes, so that's not what I'm looking for.

The reason I need this is to invalidate the cache that holds the slot, which is then passed to the resolver, which receives the data related to the deployment slot.

+4
source share
2 answers

There is no event that fires during a VIP exchange. If you want to change something when you change, I would recommend making a configuration setting and changing it before exchanging.

+2
source

You can detect the VIP exchange by checking the host header for each request sent to your WCF or web server from the gateway. You can also determine your current slot by checking if the host is a GUID.

See below how to transfer variables between calls. How to write a WCF service with persistent storage in memory?

var host = WebOperationContext.Current.IncomingRequest.Headers ["Host"] ?? "";

if (host! = currentHost) {

// do something currentHost = host; 

}

0
source

Source: https://habr.com/ru/post/897170/


All Articles