System.DllNotFoundException: Unable to load DLL 'libwkhtmltox' when deploying on Windows 2016
See original GitHub issueHi,
I saw this use case was already mentioned in other issues but I found a strange workaround.
So first some information about my environment : I’m using DinkToPdf along with some fixes provided by #18 . Everything work natively with VS2017 in a .net core 2.0 (AspNet core), I can generate any PDF I want without any problem, any errors (and without loading explicitly any DLL).
I deployed it on a Windows 2016 Server and I got the infamous System.DllNotFoundException. I tried a lot of things but finally I added in the root of my project the libwkhtmltox.dll
coming from the 0.12.3.2 windows 64bits package. And it worked perfectly fine. Swapping it with 0.12.4 does not work at all (DllNotFoundException). I tried to use the latest alpha and even if I did not have a System.DllNotFoundException, I didn’t get any PDF output (did not spend any time debugging it).
If I read wkhtmltox
changelog they switched from VS2013 to VS2015 with 0.12.4.
Can somebody with access to Windows server 2016 test and confirm ?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:5
- Comments:5
Top GitHub Comments
I am having the same issue any work around ?
fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[0] An unhandled exception has occurred: One or more errors occurred. (Unable to load DLL ‘libwkhtmltox’: The specified module could not be found. (Exception from HRESULT: 0x8007007E)) System.AggregateException: One or more errors occurred. (Unable to load DLL ‘libwkhtmltox’: The specified module could not be found. (Exception from HRESULT: 0x8007007E)) —> System.DllNotFoundException: Unable to load DLL ‘libwkhtmltox’: The specified module could not be found. (Exception from HRESULT: 0x8007007E) at DinkToPdf.WkHtmlToXBindings.wkhtmltopdf_init(Int32 useGraphics)
@seblucas: Installed 0.12.3.2 from download site to server not working …
Solved: Found the issue after spending 8 hours !!! Brand new server missing microsoft visual c++ 2010 redistributable package (x64)
Version 0.12.4 on Windows 2016 server (Azure VM) works for us.
See https://github.com/rdvojmoc/DinkToPdf/issues/5
Solution is to download and install the tool on your server https://wkhtmltopdf.org/downloads.html