[英]BadImageFormatException when deploying on windows server 2012 r2
I am deploying my Asp.net application on Windows Server 2012 R2(x64). 我正在Windows Server 2012 R2(x64)上部署我的Asp.net应用程序。 I get a runtime BadImageFormatException while using 64-bit dll. 使用64位dll时,我得到一个运行时BadImageFormatException。 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). 当我使用IIS Express或在本地机器上发布的应用程序运行它时,一切运行良好(应用程序池 - >解决方案名称 - >启用32位应用程序设置为False,解决方案中的所有项目也设置为Platform target x64)。 Deploy is going through Team City & Octopus Deploy. 部署正在通过Team City和Octopus Deploy进行。
What the solution could be? 解决方案可能是什么?
UPD System.BadImageFormatException: An attempt was made to load a program with an incorrect format. UPD System.BadImageFormatException:尝试加载格式不正确的程序。 (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 (来自HRESULT的异常:0x8007000B)位于libxl.XmlBook.xlCreateXMLBookC()的xxx.Controllers.xxx.xxxController.LibxlTest()位于C:\\ TeamCity \\ buildAgent \\ work \\ aeb63fe0b246a1f3 \\ xxx \\ xxx \\ Controllers \\ xxx \\ xxx \\ xxxController .cs:597行
There is no such path C:\\TeamCity\\buildAgent\\ on server whrere the Octopus Tentacle is. 在Octopus触手上的服务器上没有这样的路径C:\\ TeamCity \\ buildAgent \\。
Finally, it works with x86 (from bin
folder) version while the solution was build for x64. 最后,它适用于x86(来自bin
文件夹)版本,而解决方案是为x64构建的。 Probably, it is a peculiarity of libxl
. 可能,这是libxl
一个特点。 Thus, I'm developing with x64 and after deploy my post-deploy script changes it for x86 version. 因此,我正在使用x64进行开发,在部署之后,我的部署后脚本会将其更改为x86版本。
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.dll
副本,可以在64位模式下运行。
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
文件中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.