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 71 karma points
    Mar 24, 2019 @ 16:31
    Shawn Bowen

    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 330 posts 1358 karma points MVP 2x c-trib
    Mar 24, 2019 @ 17:24
    Søren Gregersen


    On the plugin page 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 71 karma points
    Mar 25, 2019 @ 04:06
    Shawn Bowen

    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
    1 week ago
    Ümit ATEŞ

    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?

Please Sign in or register to post replies

Write your reply to: