在 win 2008 r2 上迁移 .net 2.0 控制台应用程序
我有一些旧的 32 位控制台 .NET 2.0 应用程序,应该将其迁移到 win2008 r2 服务器。
注释 1: 我有一个旧的 32 位应用程序,它不加载任何程序集并且工作正常。
注释 2:当我启动其中一个应用程序时,我得到 System.BadImageFormatException 无法加载文件或程序集错误
注释 3: 他们每个人都使用NLog版本0.9.0.0。当我在新服务器上启动这些应用程序时,我在 nLOG.txt 中收到以下异常:
错误无法加载平台特定扩展:System.NullReferenceException:未将对象引用设置为对象的实例。 在 NLog.FilterFactory.AddFiltersFromAssembly(组装 theAssembly,字符串前缀) 在 NLog.Config.XmlLoggingConfiguration.LoadExtensionsFromAssembly(程序集 asm,字符串前缀) 在 NLog.Config.XmlLoggingConfiguration.RegisterPlatformSpecificExtensions(String name)
您能帮我们解决这个问题吗?先感谢您。
德韦蒂·普特尼克
I have some old 32bit console .NET 2.0 applications that should be migrated to win2008 r2 server.
Note 1: I have one old 32bit application that doesn't load any assembly and is working correctly.
Note 2: When I start one of the applications I get
System.BadImageFormatException Could not load file or assembly error
Note 3:
Each of them are using NLog version 0.9.0.0. When I start these applications on our new server, I get following exception in nLOG.txt:
Error Could not load platform specific extensions: System.NullReferenceException: Object reference not set to an instance of an object.
at NLog.FilterFactory.AddFiltersFromAssembly(Assembly theAssembly, String prefix)
at NLog.Config.XmlLoggingConfiguration.LoadExtensionsFromAssembly(Assembly asm, String prefix)
at NLog.Config.XmlLoggingConfiguration.RegisterPlatformSpecificExtensions(String name)
Can you please help us how to solve this problem? Thank you in advance.
Deveti Putnik
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
转到项目设置,并确保将目标构建为 32 位 (x86) 和“所有平台”。
您遇到的问题是 64 位可执行文件试图访问 32 位 DLL。默认情况下,.NET 可执行文件在 64 位操作系统上以 64 位运行。
Go to your project settings, and make sure you build your target to 32-bit (x86), and "All Platforms".
The problem you're seeing is a 64-bit executable trying to access a 32-bit DLL. .NET executables by default run as 64-bit on 64-bit OSes.
对于第3点:为什么不将NLog升级到2.0,对于第2点:“System.BadImageFormatException无法加载哪个程序集的文件或程序集”您可以找出导致此问题的程序集名称吗,它应该出现在错误消息中
For point 3:Why not Upgrade NLog to 2.0, For point 2: "System.BadImageFormatException Could not load file or assembly for which assembly" can you find out assemby name causing this problem,it should be there in error message