在加载Seriog.sinks.sinks.systemconsole时无法加载kernel32.dll

发布于 2025-02-06 18:23:26 字数 637 浏览 4 评论 0原文

我们在.NET 6应用程序中引用Serilog Nuget软件包。然后,我们使用AssemblyDependendencyResolver.resolveunmanagedDllTopath将应用程序组件作为插件加载。它找不到通过serialog.sinks.systemconsole引用的kernel32.dll。

我们的问题是:

  1. 这是因为net 6不支持Serilog吗?
  2. 它是从Serilog加载的32位或64位版本的kernal32.dll吗?

问题2的后续措施: 加载32位内核32.dll时,我们会得到不良的图像格式异常,这意味着我们的应用程序为64位,并试图加载32位组件。 在用64位kernel32.dll替换32位时,我们会收到以下错误:

无法加载dll'C:\ kernel32.dll'或其依赖项之一:找不到指定的过程。 (0x8007007f)在System.Runtime.InterOpservices.nativelibrary.loadfrompath(字符串LibraryName,boolean throwonError)at system.runtime.interopservices.nativelibrary.load(String libraryPath)

We are referencing Serilog Nuget package in our .Net 6 application. Then we use AssemblydependencyResolver.ResolveUnmanagedDllToPath to load the application assembly as plugins. It can't find the kernel32.dll which is refereced via Serialog.Sinks.SystemConsole.

Our questions are:

  1. Is this because Serilog is not supported with Net 6?
  2. Is it a 32bit or 64bit version of kernal32.dll getting loaded from Serilog?

Follow-up for question 2:
When loading 32bit kernel32.dll, we get a bad image format exception, which means our application is 64bit and trying to load a 32bit assembly.
When replacing the 32bit with 64bit kernel32.dll, we get the following error:

Unable to load DLL 'C:\kernel32.dll' or one of its dependencies: The specified procedure could not be found. (0x8007007F) at System.Runtime.InteropServices.NativeLibrary.LoadFromPath(String libraryName, Boolean throwOnError) at System.Runtime.InteropServices.NativeLibrary.Load(String libraryPath)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文