0

Azure SDKのバージョン1.3以降、webrole.csではなくWebアプリケーション(例:global.asax)内で構成パブリッシャーを設定する必要があります。RoleEnvironment.Changed/Changingイベントをフックする場合も同じですか?

4

1 に答える 1

3

場合によります。Web アプリケーションは WebRole.cs とは異なるプロセスで実行されます。つまり、ユース ケースに応じて、これらのいずれか (または両方) で処理する必要があります。

例: global.asax に、オブジェクトを保持する静的プロパティがあるとします。このオブジェクトは、サービス構成からの情報で初期化されています。数日後、ポータルでこの構成を変更します (おそらく接続文字列)。これにより、RoleEnvironment.Changing イベントが発生します。その場合、Web アプリケーション (global.asax) でそのイベントを処理して、新しい構成情報で静的オブジェクトを再初期化する必要があります。

Note that a web application is not always active, it's only fired up after the first request (you can modify this though, but this is the default behavior). Meaning that in some cases you might not be able to handle the event in the web application because the process is not active. If handling the event is crucial for you, you should consider handling it in the WebRole.cs

于 2012-05-30T11:00:02.580 に答える