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?
This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/96459-imageprocessorpluginswebp-cannot-load-libwebpdll