Is it possible to recycle app pool for websites hosted in Azure Web app. Usually website hosted on a vm or as a web role we could create a powershell script which creates ps session and recycle the app pool. Is there a similar approach we can use for Azure Web app?
Asked
Active
Viewed 7,213 times
5

Martin Liversage
- 104,481
- 22
- 209
- 256

kumar
- 8,207
- 20
- 85
- 176
-
Does this answer your question? [How do I schedule an AppPool refresh for an Azure Web-App service?](https://stackoverflow.com/questions/45672506/how-do-i-schedule-an-apppool-refresh-for-an-azure-web-app-service) – Edward Brey Nov 21 '22 at 16:49
2 Answers
6
Using the Kudo console / editor you can edit the web.config file to include a comment such as the one below.
<-- Test -->
After saving this file the AppPool should recycle.
In testing this brings the application much faster than restarting the webapp through the Azure portal.

Brett Larson
- 161
- 1
- 4
-
1Also, you can double confirm this via Kudu -> Process Explorer -> w3wp.exe's pid should change to a new number too. – kepung Jul 12 '20 at 20:48
3
You can use Azure PowerShell to manage Azure web apps. In your case Restart-AzureRmWebApp
is the cmdlet you want to use.
The typical way to do this is to first sign in to Azure and then execute PowerShell commands:
Login-AzureRmAccount
# Only required if you need to select a specific subscription
Set-AzureRmContext -SubscriptionName "MySubscriptionName"
Restart-AzureRmWebApp -ResourceGroupName "Default-Web-WestUS" -Name "ContosoSite"

Martin Liversage
- 104,481
- 22
- 209
- 256
-
1Does this recycle the AppPool or does it perform an IIS reset? It seems like the latter in testing. – Brett Larson Feb 02 '19 at 00:02