Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

BadImageFormatException when deploying on windows server 2012 r2

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.

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

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

like image 932
col403 Avatar asked Mar 22 '26 16:03

col403


1 Answers

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.

like image 144
col403 Avatar answered Mar 24 '26 06:03

col403



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!