问题
Here's the situation -
A window service which I am coding uses Linq2Excel, which insist the invoking application to be complied against x86.
However, the window service is to be installed on a 64-bit Windows server.
Using corflags, I am able to get the 32-bit window service to install. However, it'll refuse to load Linq2Excel. Here's the exception in all its glory:
Exception occurs: Could not load file or assembly 'LinqToExcel, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null' or one of its dependencies.
An attempt was made to load a program with an incorrect format.
What is the solution to get this service working? (Changing the server to 32-bit is not going to happen, using Linq2Excel is a must)
回答1:
If everything is 32 bit it should work fine on 64dit machine, but 32bit app could not load 64bit dll, you can make out of process call using WCF or whatever
来源:https://stackoverflow.com/questions/6493948/running-a-32-bit-window-service-which-loads-a-32-bit-dll-as-a-64-bit-service