Answer the question
In order to leave comments, you need to log in
How to properly perform regular operations on the site when using slots?
A site (App Service) is used on Azure.
For deployment without interrupting the service, two slots are used - the new version is uploaded to the second slot, and then there is a switch between slots.
Once a day, you need to do some operations, for this, when you start the application, the following code is launched
// В Global.asax
protected void Application_Start(){
// ...
var t = new Thread(new SomeClass().SomeMethod);
t.Start;
// ...
}
// В SomeClass
public void SomeMethod(){
while (true) {
// Проверяем что наступили новые сутки и делаем некую работу
Thread.Sleep(TimeSpan.FromHours(1);
}
}
if (Environment.GetEnvironmentVariable("IsProduction") == null || Environment.GetEnvironmentVariable("IsProduction") != "true") return;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question