3

我有一个 ASP.NET MVC 5 应用程序,并且我已经升级到最新的 SDK 2.1.0.3,看起来好像 ImageResizer 已经爆炸了。有解决办法吗?这是详细信息:

=== Pre-bind state information ===
LOG: DisplayName = Microsoft.WindowsAzure.Storage, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
 (Fully-specified)
LOG: Appbase = xxx
LOG: Initial PrivatePath = xxx
Calling assembly : ImageResizer.Plugins.AzureReader2, Version=3.4.0.763, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: x
LOG: Using host configuration file: x
LOG: Using machine configuration file from x
LOG: Post-policy reference: Microsoft.WindowsAzure.Storage, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/6038b9fb/8488b4a1/Microsoft.WindowsAzure.Storage.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/6038b9fb/8488b4a1/Microsoft.WindowsAzure.Storage/Microsoft.WindowsAzure.Storage.DLL.
LOG: Attempting download of new URL x
WRN: Comparing the assembly name resulted in the mismatch: Revision Number
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

[FileLoadException: Could not load file or assembly 'Microsoft.WindowsAzure.Storage, Version=2.1.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.Storage, Version=2.1.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) +9874840
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254
4

3 回答 3

5

如果您尝试Add-BindingRedirect但它让您无处可去(它没有为我添加正确的重定向),您需要将以下内容添加到您的Web.Config

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

        <!-- Other bindings here! -->

        <dependentAssembly>
            <assemblyIdentity name="Microsoft.WindowsAzure.Storage" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
            <bindingRedirect oldVersion="0.0.0.0-2.1.0.3" newVersion="2.1.0.3"/>
        </dependentAssembly>
    </assemblyBinding>
于 2013-10-30T10:20:53.823 回答
1

在 NuGet 包管理器控制台中,运行以下命令:

PM> Add-BindingRedirect

这应该使您能够使用用于 ImageResizer 的最后一个版本的不同版本的 Azure SDK。如果您通过 NuGet 安装/升级 Microsoft.WindowsAzure.Storage,这应该(但可能不会)已自动运行。

于 2013-10-28T19:33:25.120 回答
0

您的部署中似乎缺少一个文件。您是否引用 Microsoft.WindowsAzure.Storage v2.1.0.0 并将其设置为 CopyLocal=true?

于 2013-10-27T03:19:39.607 回答