在加载Seriog.sinks.sinks.systemconsole时无法加载kernel32.dll
我们在.NET 6应用程序中引用Serilog Nuget软件包。然后,我们使用AssemblyDependendencyResolver.resolveunmanagedDllTopath将应用程序组件作为插件加载。它找不到通过serialog.sinks.systemconsole引用的kernel32.dll。
我们的问题是:
- 这是因为net 6不支持Serilog吗?
- 它是从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:
- Is this because Serilog is not supported with Net 6?
- 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论