匯出 (0) 列印
全部展開

RoleEnvironment.Stopping 事件

Occurs when a role instance is about to be stopped.

命名空間: Microsoft.WindowsAzure.ServiceRuntime
組件: Microsoft.WindowsAzure.ServiceRuntime (在 microsoft.windowsazure.serviceruntime.dll 中)

'用途
Dim handler As EventHandler(Of RoleEnvironmentStoppingEventArgs)

AddHandler RoleEnvironment.Stopping, handler

public:
static event EventHandler<RoleEnvironmentStoppingEventArgs^>^ Stopping {
	void add (EventHandler<RoleEnvironmentStoppingEventArgs^>^ value);
	void remove (EventHandler<RoleEnvironmentStoppingEventArgs^>^ value);
}
/** @event */
public static void add_Stopping (EventHandler<RoleEnvironmentStoppingEventArgs> value)

/** @event */
public static void remove_Stopping (EventHandler<RoleEnvironmentStoppingEventArgs> value)

The Stopping event is used to run code when a role instance is being stopped. This event is raised after the role instance has been taken out of the rotation of the load balancer, but before the OnStop method is called. You can use this event to run code that is required for a role instance to shut down correctly. The Stopping event is not raised when the virtual machine of the role instance is rebooted.

The following code example shows how you can run code when the role instance is being stopped:


public override bool OnStart()
{
   RoleEnvironment.Stopping += RoleEnvironmentStopping;
  
   return base.OnStart();
} 

private void RoleEnvironmentStopping(object sender, RoleEnvironmentStoppingEventArgs e) 
{
   // Add code that is run when the role instance is being stopped
}

開發平台

Windows XP Home Edition, Windows XP Professional, Windows Server 2003、Windows Server 2008 和 Windows 2000

目標平台

社群新增項目

Microsoft 正展開一份線上問卷調查,了解您對於 MSDN 網站的看法。 如果您選擇參加,您離開 MSDN 網站時即會顯示線上問卷調查。

您是否想要參加?
顯示:
© 2014 Microsoft