DinkToPdf Net Core无法加载DLL文件

编程入门 行业动态 更新时间:2024-10-26 19:27:41
本文介绍了DinkToPdf Net Core无法加载DLL文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我尝试使用 DinkToPdf 库从html sql服务器数据库生成PDF.

I am try to generate PDF from html sql server database using DinkToPdf library.

在启动文件中,我已添加

In the Startup file I have added

var context = new CustomAssemblyLoadContext(); context.LoadUnmanagedLibrary(Path.Combine(Directory.GetCurrentDirectory(), "libwkhtmltox.dll"));

该行使我在启动Web应用程序时出错

The line gives me error on launching the web app

DllNotFoundException:无法加载DLL'C:\ Program Files \ IIS Express \ libwkhtmltox.dll'或其依赖项之一:找不到指定的模块.(来自HRESULT的异常:0x8007007E)

DllNotFoundException: Unable to load DLL 'C:\Program Files\IIS Express\libwkhtmltox.dll' or one of its dependencies: The specified module could not be found. (Exception from HRESULT: 0x8007007E)

System.Runtime.Loader.AssemblyLoadContext.InternalLoadUnmanagedDllFromPath(字符串unmanagedDllPath)

System.Runtime.Loader.AssemblyLoadContext.InternalLoadUnmanagedDllFromPath(string unmanagedDllPath)

DllNotFoundException:无法加载DLL'C:\ Program Files \ IIS Express \ libwkhtmltox.dll'或其依赖项之一:找不到指定的模块.(来自HRESULT的异常:0x8007007E)

DllNotFoundException: Unable to load DLL 'C:\Program Files\IIS Express\libwkhtmltox.dll' or one of its dependencies: The specified module could not be found. (Exception from HRESULT: 0x8007007E)

在可能的情况下尽力提供帮助

Kindly assist wherever you can

推荐答案

我找到了一些解决方法.它们并不完美,但是值得一试,它们确实提供了帮助,并且我能够从SQl Server生成PDF.我将.dll文件放在以下文件夹中,并且可以正常工作.

I found some work-arounds. They are not perfect but worth a try, and they did do help and I was able to generate PDFs from SQl Server. I put the .dll files in the following folder and it worked.

C:\ Program Files \ IIS Express

C:\Program Files\IIS Express

并使用

Path.Combine(Directory.GetCurrentDirectory(), "libwkhtmltox.dll");

我走遍整个路径的另一种方式

The other way I went for the whole Path

context.LoadUnmanagedLibrary(Path.GetFullPath(@"C:\Users\User\source\repos\WebSolution\WebApp\libwkhtmltox.dll"));

他们两个都工作了.但是,我敦促Net Core开发人员在GetCurrentDir上做得很好.或从项目或解决方案文件夹中加载的方法

Both of them worked. However, I urge Net Core developers to work on the GetCurrentDir very well. Or a Method to load from the Project or Solution Folder

Path.Combine(Directory.GetCurrentDirectory(), "libwkhtmltox.dll");

更多推荐

DinkToPdf Net Core无法加载DLL文件

本文发布于:2023-11-14 02:43:28,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1586005.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:加载   文件   Net   DinkToPdf   DLL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!