영업: 1-800-867-1380

RoleEnvironment.Changing 이벤트

Occurs before a change to the service configuration is applied to the running instances of a role.

네임스페이스: Microsoft.WindowsAzure.ServiceRuntime
어셈블리: Microsoft.WindowsAzure.ServiceRuntime(microsoft.windowsazure.serviceruntime.dll)

‘사용 방법
Dim handler As EventHandler(Of RoleEnvironmentChangingEventArgs)

AddHandler RoleEnvironment.Changing, handler

public static event EventHandler<RoleEnvironmentChangingEventArgs> Changing
/** @event */
public static void add_Changing (EventHandler<RoleEnvironmentChangingEventArgs> value)

/** @event */
public static void remove_Changing (EventHandler<RoleEnvironmentChangingEventArgs> value)

The Changing event and the Changed event are used together to identify and manage configuration changes to the service model. By using the Changing event, an instance can respond to a configuration change in one of the following ways:

  • Accept the configuration change while it is running, without going offline.

  • Set the Cancel property of RoleEnvironmentChangingEventArgs to true to take the instance offline, apply the configuration change, and then bring the instance back online.

By using the Cancel property, you can ensure that the instance proceeds through an orderly shutdown sequence and is taken offline before the configuration change is applied. During the shutdown process, Windows Azure raises the Stopping event, and then runs any code in the OnStop method.

The following code example shows how to apply the configuration changes after the role instances are restarted:


public override bool OnStart()
{
   RoleEnvironment.Changing += RoleEnvironmentChanging;
  
   return base.OnStart();
}

private void RoleEnvironmentChanging(object sender, RoleEnvironmentChangingEventArgs e) 
{
   // Implements the changes after restarting the role instance
   if ((e.Changes.Any(change => change is RoleEnvironmentConfigurationSettingChange))) 
   {
      e.Cancel = true;
   }
}

This event occurs after the change has been submitted to Windows Azure but before the changes have been applied to each running role instance.


개발 플랫폼

Windows XP Home Edition, Windows XP Professional, Windows Server 2003, Windows Server 2008 및 Windows 2000

대상 플랫폼

이 정보가 도움이 되었습니까?
(1500자 남음)
의견을 주셔서 감사합니다.

커뮤니티 추가 항목

표시:
© 2014 Microsoft