3 つのプロジェクトを含む VS2012 で Azure ソリューションを実行しようとしています。
- InSysDashboard (Web ロール)
- InSysService (Web ロール)
- InSysWatcher (ワーカー ロール)
3. が追加される前は、1. と 2. は問題なくビルドおよびデプロイされていました。3. それ自体で問題なくビルドされ、問題なくデプロイされます (ただし、ロールを個別にデプロイすることはできず、同じパッケージの一部としてデプロイする必要があるため、もちろんこれは適切ではありません)。
問題は、 https://github.com/WindowsAzure/azure-sdk-for-net/tree/sdk_1.7.1からダウンロードしてコンパイルした Azure SDK 1.7.1 Microsoft.WindowsAzure.StorageClient にあるようです。このリソースの Microsoft.WindowsAzure.StorageClient と Microsoft.WindowsAzure.Configuration ライブラリ、および VS2012 1.7 June SDK の Microsoft.WindowsAzure.Diagnostics と Microsoft.WindowsAzure.ServiceRuntime の両方を使用しています。
3 つのプロジェクトすべてを含むソリューションは、エラーなしでコンパイルされます。
どのプロジェクトにも Microsoft.WindowsAzure.StorageClient 1.7 への明示的な参照はなく、1.7.1 のみです。
ただし、ソリューションを実行しようとすると、ワーカー ロール (3.) の読み込みに失敗します。出力ウィンドウには、次のスニペットが含まれています。
'WaIISHost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.ApplicationServices\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.ApplicationServices.dll'
'WaIISHost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Data.Entity\v4.0_4.0.0.0__b77a5c561934e089\System.Data.Entity.dll'
Microsoft.WindowsAzure.ServiceRuntime Information: 200 : Role entrypoint . CALLING OnStart()
Microsoft.WindowsAzure.ServiceRuntime Information: 203 : Role entrypoint . CALLING Run()
Microsoft.WindowsAzure.ServiceRuntime Information: 100 : Role environment . INITIALED RETURNED. HResult=0
'WaIISHost.exe' (Managed (v4.0.30319)): Loaded 'F:\Everything\Current_Work\Web_Apps\Azure\InSys\InSysCloud\csx\Debug\roles\InSysService\approot\bin\Microsoft.WindowsAzure.Diagnostics.dll'
Microsoft.WindowsAzure.ServiceRuntime Information: 101 : Role environment . INITIALIZED
'WaWorkerHost.exe' (Managed (v4.0.30319)): Loaded 'F:\Everything\Current_Work\Web_Apps\Azure\InSys\InSysCloud\csx\Debug\roles\InSysWatcher\approot\Microsoft.WindowsAzure.StorageClient.dll'
Microsoft.WindowsAzure.ServiceRuntime Information: 202 : Role entrypoint . COMPLETED OnStart()
The thread 'Role Initialization Thread' (0xaa4) has exited with code 0 (0x0).
Microsoft.WindowsAzure.ServiceRuntime Information: 203 : Role entrypoint . CALLING Run()
'WaWorkerHost.exe' (Managed (v4.0.30319)): Loaded 'F:\Everything\Current_Work\Web_Apps\Azure\InSys\InSysCloud\csx\Debug\roles\InSysWatcher\approot\InSysWatcher.dll', Symbols loaded.
'WaWorkerHost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.ApplicationServices\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.ApplicationServices.dll'
Microsoft.WindowsAzure.ServiceRuntime Critical: 201 : Role entrypoint could not be created:
System.TypeLoadException: Unable to load the role entry point due to the following exceptions:
-- System.IO.FileLoadException: Could not load file or assembly 'Microsoft.WindowsAzure.StorageClient, Version=1.7.1.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'Microsoft.WindowsAzure.StorageClient, Version=1.7.1.0, Culture=neutral, PublicKeyToken=null'
=== Pre-bind state information ===
LOG: User = BertiesExtreme\bertie
LOG: DisplayName = Microsoft.WindowsAzure.StorageClient, Version=1.7.1.0, Culture=neutral, PublicKeyToken=null
(Fully-specified)
LOG: Appbase = file:///F:/Everything/Current_Work/Web_Apps/Azure/InSys/InSysCloud/csx/Debug/roles/InSysWatcher/approot
LOG: Initial PrivatePath = F:\Everything\Current_Work\Web_Apps\Azure\InSys\InSysCloud\csx\Debug\roles\InSysWatcher\approot
Calling assembly : InSysWatcher, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
LOG: This bind starts in default load context.
LOG: Using application configuration file: F:\Everything\Current_Work\Web_Apps\Azure\InSys\InSysCloud\csx\Debug\roles\InSysWatcher\approot\InSysWatcher.dll.config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///F:/Everything/Current_Work/Web_Apps/Azure/InSys/InSysCloud/csx/Debug/roles/InSysWatcher/approot/Microsoft.WindowsAzure.StorageClient.DLL.
WRN: Comparing the assembly name resulted in the mismatch: PUBLIC KEY TOKEN
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
-- System.IO.FileLoadException: Could not load file or assembly 'Microsoft.WindowsAzure.StorageClient, Version=1.7.1.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'Microsoft.WindowsAzure.StorageClient, Version=1.7.1.0, Culture=neutral, PublicKeyToken=null'
最後のエントリは、Microsoft.WindowsAzure.StorageClient の問題を示しているようです。
ソリューションのビルド時に生成された CSX フォルダーの中を見ると、見つかったプロジェクトごとに次のようになります。
- Release/roles/InSysDashboard/approot/Microsoft.WindowsAzure.StorageClient.dll (1.7.1)
- Release/roles/InSysService/approot/Microsoft.WindowsAzure.StorageClient.dll (1.7.1)
- Release/roles/InSysWatcher/approot/Microsoft.WindowsAzure.StorageClient.dll (これは1.7.0です)
何らかの理由で、Microsoft.WindowsAzure.StorageClient.dll のバージョン 1.7.0 がワーカー ロールに含まれています。参照リストを確認したところ、1.7.0 ではなく 1.7.1 が確実に含まれているのに、なぜ 1.7.0 が含まれているのでしょうか? この段階では、これがワーカー ロールが実行されていない理由であると想定しています。
何か案は?
いくつかの詳細情報:
C:\Program Files\Microsoft SDKs\Windows Azure.NET SDK\2012-06\ref にある Microsoft.WindowsAzure.StorageClient.dll (1.7.0.0) のバージョンを 1.7.1.0 バージョンに置き換えると、 Microsoft.WindowsAzure.Diagnostics に関連するエラー。
{"Could not create Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35."}
そして内部例外で:
{"Could not load file or assembly 'Microsoft.WindowsAzure.StorageClient, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)":"Microsoft.WindowsAzure.StorageClient, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"}
Microsoft.WindowsAzure.Diagnostics は Microsoft.WindowsAzure.StorageClient 1.7.0.0 に依存しているようで、1.7.1.0 に置き換えると問題が発生します。依存関係がハードコーディングされていると思います。