Windows Azure MMC与Windows Azure SDK 1.3版本的兼容问题

来源:互联网 发布:php 图片自动切换代码 编辑:程序博客网 时间:2024/06/06 04:50

根据http://archive.msdn.microsoft.com/windowsazuremmc的描述,我下载了Windows Azure MMC工具,用以对Windows Azure和Dev Fabric中的Hosted Service、Storage等进行简单维护。该工具解压后,会产生一个starthere.cmd文件进行安装,并且产生一个release文件夹,里面包含了windowsazuremmc.msc,双击该文件可以启动。

 

我的机器安装了Windows 2008 R2, Visual Studio 2010, Windows Azure SDK 1.3,Windows Azure Tools 1.3 for VS 2010。但运行starthere.cmd到最后步骤,出现错误,之后运行windowsazuremmc.msc会报下列错误:

 

 

点击确定后会出现下列错误:

 

具体错误如下:

未能加载文件或程序集“Microsoft.Samples.WindowsAzureMmc.ServiceManagement, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null”或它的某一个依赖项。系统找不到指定的文件。

 

在网上搜索到相应的原因及解决方案( 参见:http://dunnry.com/blog/2010/11/30/UsingWindowsAzureMMCAndCmdletWithWindowsAzureSDK13.aspx )

WindowsAzureMMC与Windows Azure SDK 1.3中Microsoft.WindowsAzure.StorageClient.dll版本不兼容。MMC原本要求Windows Azure SDK 1.2中1.0版本的StorageClient.dll;而Windows Azure SDk 1.3中只提供1.1版本的StorageClient.dll。

我采用的解决办法是:

在windows/system32目录下建立一个mmc.exe.config文件,对该dll进行调用重定向。在文件中填入下列内容:

 <configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.WindowsAzure.StorageClient" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="1.0.0.0" newVersion="1.1.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.WindowsAzure.StorageClient" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <publisherPolicy apply="no" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

 

然后来就OK了: