无法使用StorageClient 1.7.1运行Azure项目

时间:2012-09-16 22:42:52

标签: azure storage worker

我正在尝试在VS2012中运行包含三个项目的Azure解决方案:

  1. InSysDashboard(Web角色)
  2. InSysService(Web角色)
  3. InSysWatcher(工作者角色)
  4. 在添加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。

    包含所有三个项目的解决方案编译时没有错误。

    在任何项目中都没有明确引用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文件夹,我会找到每个项目:

    1. 发布/角色/ InSysDashboard / approot / Microsoft.WindowsAzure.StorageClient.dll(1.7.1)
    2. 发布/角色/ InSysService / approot / Microsoft.WindowsAzure.StorageClient.dll(1.7.1)
    3. 发布/角色/ InSysWatcher / approot / Microsoft.WindowsAzure.StorageClient.dll( 1.7.0
    4. 由于某种原因,工作者角色包含了Microsoft.WindowsAzure.StorageClient.dll的1.7.0版本。我检查了参考列表,它肯定包含1.7.1 NOT 1.7.0,那么为什么1.7.0会被包括在内?我假设在这个阶段这是工作者角色没有运行的原因。

      有什么想法吗?

      更多信息:

      如果我使用1.7.1.0版本替换C:\ Program Files \ Microsoft SDKs \ Windows Azure.NET SDK \ 2012-06 \ ref中的Microsoft.WindowsAzure.StorageClient.dll(1.7.0.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会导致出现问题。我猜这种依赖是硬编码的。

2 个答案:

答案 0 :(得分:0)

注释掉InSysWatcher(工作者角色)的app.config的systems.diagnostics部分似乎有所帮助,即现在可以部署解决方案并且似乎按预期运行。这似乎不是“正确”的方式,但在花了将近2天之后,就此“无论如何工作”。

答案 1 :(得分:0)

完全令人沮丧的是,我所发现的所有工作都是清理VS中的解决方案并再试一次 - 有时在解决方案运行之前需要多次清理。

似乎在GAC中存在另一版本的StorageClient时会出现冲突