c# - Imageresizer.AzureReader2 不适用于最新的 Azure SDK 2.1.0.3

标签 c# azure imageresizer

我有一个 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

最佳答案

如果您尝试 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>

关于c# - Imageresizer.AzureReader2 不适用于最新的 Azure SDK 2.1.0.3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19611270/

相关文章:

c# - Ninject 动态构造函数参数

c# - 在不同的 Azure 服务总线队列中使用相同的消息 ID 会导致错误

c# - 3 层 asp.net mvc 应用程序中的依赖注入(inject)

azure - 每小时对 API 进行 REST 调用并将结果保存到 Azure SQL

Azure 服务结构 : Container images not refresh

node.js - 使用 'Azure AD-Universal with MFA' 连接 Azure SQL 数据库的 NodeJs 代码

c# - ASP.NET应用程序是否可以向启动Application_Start事件的用户显示等待屏幕?

由 C# 调整图像大小

c# - 使用 ImageResizer.net 验证图像上传

imageresizer - 将 ImageFlow Server 与多个 Azure 容器结合使用