在windows server 2012 r2上部署时出现BadImageFormatException

时间:2020-12-27 18:16:39

I am deploying my Asp.net application on Windows Server 2012 R2(x64). I get a runtime BadImageFormatException while using 64-bit dll. When I run it with IIS Express or application published on local machine IIS everything works well (Application pools -> solution name -> Enable 32-bit applications set to False, All projects in solution are also set for Platform target x64). Deploy is going through Team City & Octopus Deploy.

我在Windows Server 2012 R2(x64)上部署我的Asp.net应用程序。我在使用64位dll时获得一个运行时BadImageFormatException。当我使用IIS Express或本地机器IIS上发布的应用程序运行它时,一切都运行得很好(应用程序池—>解决方案名称—>允许将32位应用程序设置为False,解决方案中的所有项目也为平台目标x64设置)。部署正在通过团队城市和章鱼部署。

What the solution could be?

解决方案是什么?

UPD System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) at libxl.XmlBook.xlCreateXMLBookC() at xxx.Controllers.xxx.xxxController.LibxlTest() in C:\TeamCity\buildAgent\work\aeb63fe0b246a1f3\xxx\xxx\Controllers\xxx\xxx\xxxController.cs:line 597

乌利希期刊指南系统。BadImageFormatException:尝试以错误的格式加载程序。(HRESULT: 0x8007000B)位于libxl.XmlBook.xlCreateXMLBookC()位于xxx.controllers.xxx.xxx.xxxcontroller . libxltest () in C:\TeamCity\buildAgent\work\aeb63fe0b246a1f3\xxx\xxx\ xxx\xxx\xxx \xxx\xxx\xxx \xxx\xxx\xxx xxx\xxx\xxx \xxx\xxx\xxx xxx\xxx\xxx \xxx\xxx\xxx \xxx\xxx\xxx \xxx\xxx\xxx \xxx\xxx\xxx \xxx\xxx\xxx \xxx\xxx\xxx \xxx\xxx\xxx \xxx\xxx\xxx \xxx\xxx\cs:597行

There is no such path C:\TeamCity\buildAgent\ on server whrere the Octopus Tentacle is.

没有这样的路径C:\TeamCity\buildAgent\ on server whrere的章鱼触须。

2 个解决方案

#1


1  

Finally, it works with x86 (from bin folder) version while the solution was build for x64. Probably, it is a peculiarity of libxl. Thus, I'm developing with x64 and after deploy my post-deploy script changes it for x86 version.

最后,它使用x86(来自bin文件夹)版本,而解决方案是为x64构建的。可能这是libxl的一个特性。因此,我正在使用x64进行开发,在部署了我的后部署脚本之后,我将它修改为x86版本。

#2


0  

OK, it looks like you or one of your references has a dependency on libXL.

好的,看起来你或者你的一个引用依赖于libXL。

Your exception result (0x8007000B) is definitely a 32-bit can't load on 64-bit issue.

您的异常结果(0x8007000B)肯定是32位不能加载64位的问题。

libXL is C++ project, in the download zip there's a bin64 folder with a copy of libxl.dll that will work in 64-bit mode.

libXL是c++项目,在下载zip文件中有一个bin64文件夹和libXL的副本。将在64位模式下工作的dll。

If you have a libXL licensed copy better to use the 64-bit dll from that.

如果您有一个libXL授权的副本,最好使用64位dll。

Note that C:\TeamCity\buildAgent\ comes from the machine your project was built on, the line numbers etc get saved into your pdb files.

注意C:\TeamCity\buildAgent\来自您的项目构建的机器,行号等等保存到pdb文件中。

#1


1  

Finally, it works with x86 (from bin folder) version while the solution was build for x64. Probably, it is a peculiarity of libxl. Thus, I'm developing with x64 and after deploy my post-deploy script changes it for x86 version.

最后,它使用x86(来自bin文件夹)版本,而解决方案是为x64构建的。可能这是libxl的一个特性。因此,我正在使用x64进行开发,在部署了我的后部署脚本之后,我将它修改为x86版本。

#2


0  

OK, it looks like you or one of your references has a dependency on libXL.

好的,看起来你或者你的一个引用依赖于libXL。

Your exception result (0x8007000B) is definitely a 32-bit can't load on 64-bit issue.

您的异常结果(0x8007000B)肯定是32位不能加载64位的问题。

libXL is C++ project, in the download zip there's a bin64 folder with a copy of libxl.dll that will work in 64-bit mode.

libXL是c++项目,在下载zip文件中有一个bin64文件夹和libXL的副本。将在64位模式下工作的dll。

If you have a libXL licensed copy better to use the 64-bit dll from that.

如果您有一个libXL授权的副本,最好使用64位dll。

Note that C:\TeamCity\buildAgent\ comes from the machine your project was built on, the line numbers etc get saved into your pdb files.

注意C:\TeamCity\buildAgent\来自您的项目构建的机器,行号等等保存到pdb文件中。