Restarting Azure Worker role “WaWorkerHost.exe” manually

眉间皱痕 提交于 2019-12-03 07:36:45
  1. The bootstrapper checks the WaWorkerHost status every 1 second.
    You can see it in the bootsrapper logs (c:\resources\WaHostBootstrapper.txt), by looking at interval of the trace:

"Getting status from client WaWorkerHost.exe"


  1. You can use AzureTools which is a utility used by Azure support team.

One of the its features is gracefully recycle the role instance:

Alternatively, you can restart the instance programmatically:

  • Upload management certificate to your subscription.
  • Use the following code to programmatically restart the instance:

Using Microsoft Azure Compute Management library:

X509Certificate2 cert = new X509Certificate2("");
var credentials = new CertificateCloudCredentials("your_subscription_id", cert);

using (var managementClient = new ComputeManagementClient(credentials))
{
    OperationStatusResponse response =
        await managementClient.Deployments.RebootRoleInstanceByDeploymentSlotAsync(
            "cloud_service_name",
            DeploymentSlot.Production, // or staging
            "instance_name");
}

  1. This is not recommended, for three reasons:

    1. The bootsrapper checks every second, which should be enough for most cases.
    2. It could lead to weird issues. For example, you kill the worker, bootstrapper identifies that the worker is down, you manually start the worker, bootstrapper also tries to start the worker and fail (will crash? will enter zombie state?). It can lead to unhealthy bootstrapper, means that nothing takes care of the worker process.
    3. It depends, of course, on what's the bootstrapper does other than starting the worker. But even if it is currently does nothing other than starting the role, you cannot know for sure if tomorrow Azure team will decide to add it more responsibilities/actions.

If the role itself is aware that it needs to restart, it can call RoleEnvironment.RequestRecycle to cause the role instance to be restarted.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!