Imageresizer.AzureReader2 doesn't work with latest Azure SDK 2.1.0.3-Collection of common programming errors


  • Ryan

    I have an ASP.NET MVC 5 application and I’ve upgraded to the latest SDK 2.1.0.3 and it seems as though ImageResizer has blown up. Are there any work arounds? Here is the details:

    === 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
    

  • Chris Skardon

    If you try Add-BindingRedirect and it gets you nowhere (it didn’t add the right redirect for me) you need to add the following into your Web.Config

    
        
    
            
    
            
                
                
            
        
    

  • kwill

    It looks like you are missing a file from your deployment. Are you referencing Microsoft.WindowsAzure.Storage v2.1.0.0 and setting it to CopyLocal=true?


  • Computer Linguist

    Within the NuGet Package Manager Console, run the following command:

    PM> Add-BindingRedirect

    This should enable you to use a different version of the Azure SDK that was used for the last version of ImageResizer. If you installed/upgraded Microsoft.WindowsAzure.Storage via NuGet, this should (but may not) have been run automatically.