Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Shawn Bowen 11 posts 72 karma points
    Mar 24, 2019 @ 16:31
    Shawn Bowen
    1

    ImageProcessor.Plugins.WebP - Cannot load libwebp.dll

    I'm attempting to implement the WebP image format using the ImageProcessor.Plugins.WebP library and the Umbraco image cropper. The package was installed using Nuget and everything works like a charm when run through Visual Studio on my development workstation. However, when I put the same source code out on a production server (Windows Server 2012 R2 Standard) the code fails with the following error:

    Server Error in '/' Application.
    Cannot load libwebp.dll
    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.ApplicationException: Cannot load libwebp.dll
    
    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.
    
    Stack Trace: 
    
    [ApplicationException: Cannot load libwebp.dll]
       ImageProcessor.Configuration.<>c__DisplayClass7_0.<RegisterNativeBinary>b__0(String b) +391
       System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) +65
       ImageProcessor.Configuration.NativeBinaryFactory.RegisterNativeBinary(String name, Byte[] resourceBytes) +86
       ImageProcessor.Plugins.WebP.Imaging.Formats.NativeMethods..cctor() +208
    
    [TypeInitializationException: The type initializer for 'ImageProcessor.Plugins.WebP.Imaging.Formats.NativeMethods' threw an exception.]
       ImageProcessor.Plugins.WebP.Imaging.Formats.NativeMethods.WebPFree(IntPtr pointer) +0
       ImageProcessor.Plugins.WebP.Imaging.Formats.WebPFormat.EncodeLossly(Bitmap bitmap, Int32 quality, Byte[]& webpData) +268
       ImageProcessor.Plugins.WebP.Imaging.Formats.WebPFormat.Save(Stream stream, Image image, Int64 bitDepth) +88
       ImageProcessor.ImageFactory.Save(Stream stream) +69
       ImageProcessor.Web.HttpModules.<ProcessImageAsync>d__34.MoveNext() +2754
       System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +99
       System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
       System.Web.TaskAsyncHelper.EndTask(IAsyncResult ar) +63
       System.Web.AsyncEventExecutionStep.InvokeEndHandler(IAsyncResult ar) +156
       System.Web.AsyncEventExecutionStep.OnAsyncEventCompletion(IAsyncResult ar) +123
    
    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.3062.0
    

    I've verified that the dll is in the /bin folder and that the Application Pool is allowing 32 bit applications enabled.

    Any thoughts on what the issue might be?

  • Søren Gregersen 441 posts 1884 karma points MVP 2x c-trib
    Mar 24, 2019 @ 17:24
    Søren Gregersen
    103

    Hi,

    On the plugin page https://imageprocessor.org/imageprocessor/plugins/webp/ it says:

    Requires msvcr120.dll from the Visual C++ Redistributable Package for Visual Studio 2013 to be installed on the server.

    If you are using version 1.0.2 or lower it instead requires msvcr110.dll from the Visual C++ Redistributable Package for Visual Studio 2012 to be installed.

    Have you verified this?

  • Shawn Bowen 11 posts 72 karma points
    Mar 25, 2019 @ 04:06
    Shawn Bowen
    0

    Yes, thanks. I made sure to install the Visual C++ Redistributable Package for Visual Studio 2012 package on the server and verified that msvcr120.dll is in fact in the C:\Windows\System32 path.

  • Ümit ATEŞ 1 post 71 karma points
    Aug 01, 2020 @ 23:15
    Ümit ATEŞ
    0

    Hello, I wanted to write about the subject because it is more than 1 year but I couldn't find a solution.

    I installed necessary packages for webp in VS 2019. When I run it with IIS Express over VS, the webp file occurred without any problem.

    I published the project and put it on my server and worked there.

    But when I define and run the project locally to IIS, it gives the error in the topic header.

    I looked at the instructions mentioned here, everything necessary was installed. IIS defines my projects and I work with it. As I explained above, webp is causing problems, so I can't include it in my project right now.

    My project is ASP.Net Core 2.2.

    Are there any solution suggestions on this subject?

  • David Armitage 510 posts 2081 karma points
    Dec 02, 2020 @ 03:28
    David Armitage
    0

    Hi,

    I am having the same issue with an Umbraco 8 site.

    Did you ever find a solution for this?

    I am experiencing the exact same problem. I have had this working locally and in multiple hosting environments without a problem.

    This specific server Cannot load libwebp.dll

    I tried copying then DDL into the bin folder to see if that fixed the issue. It didn't

  • David Armitage 510 posts 2081 karma points
    Dec 02, 2020 @ 04:57
    David Armitage
    0

    Hi,

    I can confirm I tried installing this and it did fix the issue. https://our.umbraco.com/forum/extending-umbraco-and-using-the-api/96459-imageprocessorpluginswebp-cannot-load-libwebpdll

    I have never had to install this on any of my other servers. Maybe this gets included in the .Net 3.5 framework.

    That's the only difference I can see between my working servers and this. The working ones have always has 3.5 installed where as this starts at 4.5.

    Any this is fixed so thanks Soren.

  • Mike Beale 38 posts 132 karma points
    Jan 29, 2021 @ 15:06
    Mike Beale
    0

    Hi There,

    We're having this error on a new install of Umbraco 8.11.1

    I've asked and our host is running ASP.NET 4.7.2 and have the Visual C++ Redistributable installed.

    Any idea what else could be causing this? No images that get cropped are showing on our site.

  • David Armitage 510 posts 2081 karma points
    Jan 30, 2021 @ 01:44
    David Armitage
    0

    Hi Mike,

    I think it may be down to the version C++ Redistributable

    There was one time it didn't work for me. I cant remember what the correct version is. It's either 2102 or 2013.

    From memory when I had this issue and it didn't work I also went and installed the other version and it works.

    So I guess the take away here.

    1. If you installed 2012 then go and install 2013
    2. If you installed 2013 then go and install 2012

    https://support.microsoft.com/en-us/topic/update-for-visual-c-2013-and-visual-c-redistributable-package-5b2ac5ab-4139-8acc-08e2-9578ec9b2cf1

    I have done this a number of times will latest versions of Umbraco 8 and this works perfectly in every case.

    Kind Regards

    David

  • David Armitage 510 posts 2081 karma points
    Jan 30, 2021 @ 01:46
    David Armitage
    0

    My guess is the link I provided above is the correct download version for C++ Redistributable since that's the one I had bookmarked to deal with this issue.

  • James Wilkinson 15 posts 72 karma points c-trib
    Mar 10, 2021 @ 11:15
    James Wilkinson
    0

    Hi,

    You also need to make sure that the correct version of C++ Redistributable is installed - 32bit or 64bit. This needs to match what your website is running.

    https://github.com/JimBobSquarePants/ImageProcessor/issues/764

    Kind regards,

    James.

  • Martin 1 post 71 karma points
    Jan 26, 2023 @ 14:47
    Martin
    0

    I solved this issue. here is a little more info on how and what to look for.

    First i thought that i was missing the libwebp.dll but upon examining the error message i saw that its the initialization of an object within the dll that fails, so that means libwebp is not missing but probably some dependency that is missing. Error message: "The type initializer for 'ImageProcessor.Plugins.WebP.Imaging.Formats.NativeMethods' threw an exception. ---> System.ApplicationException: Cannot load libwebp.dll"

    So it seems that msvcr120.dll needs to be present in windows\system32 folder. To get it there, i ended up first uninstalling and then reinstalling "Visual C++ Redistributable Packages for Visual Studio 2013" x64, because thats what we are running. Doing a repair of the package that was installed already did not work. I also needed to do an iisreset after installing the package. Here's the package: https://www.microsoft.com/en-us/download/details.aspx?id=40784

    Also, installing later packages like the "Microsoft Visual C++ 2015-2022 Redistributable" did not solve the issue, even though on another working server only, the only package that was installed there was "Microsoft Visual C++ 2015 Redistributable".

    Cheers.

  • SimonHilo 1 post 21 karma points
    Jan 30, 2024 @ 12:19
    SimonHilo
    0

    Installing Visual C++ Redistributable Packages for Visual Studio 2013 x64 solved this problem for me.

    x86 was already installed on the server, but it needed the 64bit version.

    I did not need to do further than installing and refreshing the page that had the error.

    Simon

  • Jonathon Cove 9 posts 24 karma points
    Jun 25, 2024 @ 08:04
    Jonathon Cove
    0

    I installed the redistributable but it didn't immediately fix the issue. Rather than an IIS restart, I was able to stop & start the necessary site, to cause the changes to kick in.

    Just in case anyone reading this is working on a lesser known server (as I was) and doesn't want to risk a full restart.

Please Sign in or register to post replies

Write your reply to:

Draft