ImageResizer AzureReader2 插件 Nuget 开箱即用错误

ImageResizer AzureReader2 Plugin Nuget Error Out of the Box

我在安装 ImageResizer AzureReader2 插件时遇到错误。这是在使用 Nuget 安装 ImageResizer 包的空 Web 项目中的全新安装。

它与这个问题 here 非常相似,但绑定重定向似乎无法解决该问题。我也试过更新到 3.0 有同样的问题。

这是堆栈:

    Could not load file or assembly 'Microsoft.WindowsAzure.Configuration, Version=2.0.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)

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.IO.FileLoadException: Could not load file or assembly 'Microsoft.WindowsAzure.Configuration, Version=2.0.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)

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Assembly Load Trace: The following information can be helpful to determine why the assembly 'Microsoft.WindowsAzure.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded.


=== Pre-bind state information ===
LOG: DisplayName = Microsoft.WindowsAzure.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
 (Fully-specified)
LOG: Appbase = file:///c:/workspace/CC3.Images/CC3.Images/
LOG: Initial PrivatePath = c:\workspace\CC3.Images\CC3.Images\bin
Calling assembly : ImageResizer.Plugins.AzureReader2, Version=3.4.3.103, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: c:\workspace\CC3.Images\CC3.Images\web.config
LOG: Using host configuration file: C:\Users\steve.westner\Documents\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Microsoft.WindowsAzure.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: Attempting download of new URL file:///C:/Users/steve.westner/AppData/Local/Temp/Temporary ASP.NET Files/root/ae2511c3/bb7d3a9/Microsoft.WindowsAzure.Configuration.DLL.
LOG: Attempting download of new URL file:///C:/Users/steve.westner/AppData/Local/Temp/Temporary ASP.NET Files/root/ae2511c3/bb7d3a9/Microsoft.WindowsAzure.Configuration/Microsoft.WindowsAzure.Configuration.DLL.
LOG: Attempting download of new URL file:///c:/workspace/CC3.Images/CC3.Images/bin/Microsoft.WindowsAzure.Configuration.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Major Version
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

Stack Trace: 


[FileLoadException: Could not load file or assembly 'Microsoft.WindowsAzure.Configuration, Version=2.0.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)]
   ImageResizer.Plugins.AzureReader2.AzureVirtualPathProvider..ctor(String blobStorageConnection) +0
   ImageResizer.Plugins.AzureReader2.AzureReader2Plugin.Install(Config c) +379
   ImageResizer.Configuration.PluginConfig.add_plugin_by_name(String name, NameValueCollection args) +275
   ImageResizer.Configuration.PluginConfig.loadPluginsInternal() +402
   ImageResizer.Configuration.PluginConfig.LoadPlugins() +102
   ImageResizer.Configuration.Config..ctor(ResizerSection config) +546
   ImageResizer.Configuration.Config.get_Current() +115
   ImageResizer.InterceptModule.get_conf() +36
   ImageResizer.InterceptModule.System.Web.IHttpModule.Init(HttpApplication context) +250
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +418
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296

[HttpException (0x80004005): Could not load file or assembly 'Microsoft.WindowsAzure.Configuration, Version=2.0.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)]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9931880
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34248

我通过移动到 ImageResizer 版本 4.0 堆栈解决了这个问题,该堆栈目前处于预发布阶段并且未显示在程序包管理器控制台中。

以下命令安装了所有需要的东西:

Install-Package ImageResizer.Plugins.AzureReader2 -Pre