运行将32位dll加载为64位服务的32位窗口服务 [英] Running a 32-bit window service which loads a 32-bit dll as a 64-bit service

查看:392
本文介绍了运行将32位dll加载为64位服务的32位窗口服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里是情况-

我正在编码的窗口服务使用Linq2Excel,后者坚持要求调用应用程序必须与x86兼容。

A window service which I am coding uses Linq2Excel, which insist the invoking application to be complied against x86.

但是,窗口服务将安装在64位Windows服务器上。

However, the window service is to be installed on a 64-bit Windows server.

使用corflags,我可以得到32位位窗口服务进行安装。但是,它将拒绝加载Linq2Excel。这是所有异常的例外:

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.

使该服务正常运行的解决方案是什么? (将服务器更改为32位是不可能的,必须使用Linq2Excel)

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)

推荐答案

如果一切都是32位它在64dit机器上应该可以正常工作,但是32位应用程序无法加载64位dll,您可以使用WCF或其他方法进行进程外调用

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

这篇关于运行将32位dll加载为64位服务的32位窗口服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆