Duncan Smart
Duncan Smart

Reputation: 32068

How to restart Azure Web App farm instance VM

Is there any way of simply rebooting the VM in which a site resides?

Had an issue today where git deploying a code change to our site resulted in:

D:\home\site\repository\packages\Microsoft.Net.Compilers.1.0.0\tools\Microsoft.CSharp.Core.targets(67,5): error MSB6006: "csc.exe" exited with code -1073741819. [D:\home\site\repository\Foo\Bar.csproj]

Eventually after killing VBCSCompiler.exe in the Kudu/SCM site Process Explorer and issuing a Redeploy from the portal, resulted in a successful deployment ... but then the site wouldn't spin up correctly: in EventLog.xml there was

HttpCompileException: External component has thrown an exception.
   at System.Web.Compilation.AssemblyBuilder.Compile()
   at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
   at System.Web.Compilation.ApplicationBuildProvider.GetGlobalAsaxBuildResult(Boolean isPrecompiledApp)
   at System.Web.Compilation.BuildManager.CompileGlobalAsax()
   at System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled()
   at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)

So something pretty fundamental wasn't well with the environment.

The only thing that fixed it was choosing a different App Service plan/pricing tier in the portal which then seems to result in the sites spinning up in a new VM (we noticed that %COMPUTERNAME% changed).

Is there a better way to get a new VM instance than randomly swapping between different pricing tier every time this happens?

Upvotes: 1

Views: 1823

Answers (2)

Zain Rizvi
Zain Rizvi

Reputation: 24636

You already have all the answers, but to summarize:

You can't directly restart the VM a site runs on. But you can do two things instead:

  1. Scale up and scale down your site. This will cause your site to be moved to a random VM
  2. Stop and start your site. This will restart the w3wp process rather than restarting the VM. Any other sites running on that same VM will not be affected.

Upvotes: 3

Joe Raio
Joe Raio

Reputation: 1805

You can try restarting the site right from the Azure Portal on the Web App management blade.

enter image description here

Upvotes: 3

Related Questions