I have a web app running on a Basic Tier with logged in users.
The web server appears to restart randomly about once a day which interrupts these users.
How can I get it to restart overnight instead?
I have a web app running on a Basic Tier with logged in users.
The web server appears to restart randomly about once a day which interrupts these users.
How can I get it to restart overnight instead?
If your running Azure as App Service and you want to restart your application on a scheduled basis then You can achieve this by creating a web job and placing a PowerShell script to STOP and START the web app. Please follow the steps below to implement this for your web app.
To perform START/STOP operation on Azure App Service, the job should have access to your subscription. Please run below Power-Shell script to create a native AD application from which we will get service principal ID that will be used to do silent authentication. This is a one time job.
Note : You need to be a Global admin on Active Directory to create the native AD application.
Please follow the link below
https://docs.microsoft.com/en-us/archive/blogs/karansingh/azure-app-services-automate-application-restart-using-web-job
Note: Please follow the link below for information about scheduling web job using CRON expression:
https://docs.microsoft.com/en-us/azure/app-service-web/web-sites-create-web-jobs
If the Answer is helpful, please click Accept Answer and up-vote, this can be beneficial to other community members.
Thanks for responding promptly but this does not answer my question at all.
The web server appears to restart randomly about once a day which interrupts these users.
How can I get the web server to restart overnight instead?
Thanks for asking question! If I have understood right you are having azure web app with basic sku and wants to schedule restart of web app in night, If so you can use WebJobs to run a background task to restart the Web App on a schedule.
WebJobs is a feature of Azure App Service that enables you to run a program or script in the same instance as a web app, API app, or mobile app. There is no additional cost to use WebJobs.

Further you have to place a PowerShell script to STOP and START the web app.
Would recommend you to this detailed blog on: Azure App Services: Automate Application restart using Web Job
In case if you are looking for an autodetect certain conditions and automatically recover by simple mitigation steps as restarting the process.
You can refer to this blog: Announcing the New Auto Healing Experience in App Service Diagnostics
Please let us know if further query or issue remains, Looking forward to help you on this.
To follow-up, Please let us know if you have further query on this.
Please don’t forget to Accept the answer
"you are having Azure web app with Basic Tier and wants to schedule restart of web app in night"
Well, no you didn't understand me right, but thanks for trying.
I want the web server to not interrupt my web app (and its logged in users) during the day.
If that's not possible then please just tell me that.
If I have failed to interpret what is happening correctly, then that would also be helpful to know.
Thanks for reply Could you please confirm if you have set up your own IIS server or if hosting same on VM IIS server like the azure part of it.
If your ask is similar to this:
https://community.spiceworks.com/topic/2087818-scheduled-restart-of-iis
https://docs.microsoft.com/en-us/azure/automation/automation-solution-vm-management
Disclaimer: This response contains a reference to a third-party World Wide Web site. Microsoft is providing this information as a convenience to you.
Let us know.
Hi Sneha,
Thanks for looking again at this.
We have not set up our own IIS server. We are hosting the web app on the Basic B1 tier, so the Azure Portal does not give us any controls for the web server.
Thanks for the links, but they only apply to users with their own IIS or VM.
As I said before, I want the web server to not interrupt my web app during the day. If that's not possible, then please just tell me that.
13 people are following this question.