2

vmロールインスタンスのステータスをビジーからレディに変更する方法はありますか。可能であれば、wcfサービスでこれを実行したいと思います。どうもありがとう。

4

1 に答える 1

4

Fabric Controllerは、インスタンスのステータスを定期的にチェックします。そうすることで、インスタンスがビジーであるかどうかを通知できます。

StatusCheckイベントを処理し、 ( SetBusyメソッドを呼び出して)ビジーに設定するだけです。インスタンスの準備ができている(ビジーではなくなった)と判断したら、SetBusyメソッドの呼び出しを停止します。

public override bool OnStart()
{
   RoleEnvironment.StatusCheck += RoleEnvironmentStatusCheck;

   return base.OnStart();
}

// Use the busy object to indicate that the status of the role instance must be Busy
private volatile bool busy = true;

private void RoleEnvironmentStatusCheck(object sender, RoleInstanceStatusCheckEventArgs e)
{
   If (this.busy)
   {
      // Sets the status of the role instance to Busy for a short interval.
      // If you want the role instance to remain busy, add code to 
      // continue to call the SetBusy method
      e.SetBusy();
   }
}

参照: http: //msdn.microsoft.com/en-us/library/microsoft.windowsazure.serviceruntime.roleenvironment.statuscheck.aspx

于 2012-05-11T11:39:39.270 に答える