Czy ta strona była przydatna?
Twoja opinia na temat zawartości jest dla nas bardzo ważna. Powiedz nam co myślisz.
Dodatkowe opinie?
Pozostało znaków: 1500
Baza Wiedzy MSDN
Ta zawartość nie jest dostępna w wymaganym języku. Wersja w języku angielskim znajduje się tutaj.

Use the RoleEnvironment.Changed Event

Updated: October 24, 2014

The Changed event occurs after a configuration change is applied to a role instance.

The RoleEnvironmentChangingEventArgs class provides a Changes property that returns the collection of the configuration changes that were applied to the instance. The Changed event is raised after the changes have been applied. The new values for the configuration settings can be retrieved from the RoleEnvironment.GetConfigurationSettingValue method, while the old values are no longer available.

  1. Open the source file for the role.

  2. Ensure that the project references the Microsoft.WindowsAzure.ServiceRuntime.dll file and that the following using statement is added to the file:

    using Microsoft.WindowsAzure.ServiceRuntime;
  3. Add the following code to specify the event handler:

    RoleEnvironment.Changed += (sender, args) =>
       if (args.Changes.Any(chg => chg is RoleEnvironmentTopologyChange)) 
          // Perform an action, for example, you can initialize a client, 
          // or you can recycle the role
  4. Save the file.

See Also

© 2015 Microsoft