我使用 Visual Studio 2010 和 .NُET 4.0 创建了一个非常简单的窗口服务。
该服务没有从默认的 Windows 服务项目中添加任何功能,只是添加了一个安装程序。
如果我在我的开发盒或我们域中的其他 Windows 2008 R2 机器上运行“installutil.exe appName.exe”,则 Windows 服务将毫无问题地安装。
当我尝试在我们的客户站点上做同样的事情时,它无法安装并出现以下错误。
Microsoft (R) .NET Framework Installation utility Version 4.0.30319.1
Copyright (c) Microsoft Corporation. All rights reserved.
Exception occurred while initializing the installation:
System.IO.FileLoadException: Could not load file or assembly 'file:///C:\TestService\WindowsService1.exe' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515).
此解决方案只有 1 个项目,没有添加任何依赖项。
我已经在我们环境中的多台机器和我们的客户中的两台机器上尝试过它。这些机器都是windows 2008 R2,都是全新安装的。一台机器只有 .net 2.0 和 .net 4.0。另一个 .net 2、3、3.5 和 4。
我是每台机器的本地管理员。
我也尝试了 64 位安装程序,但收到以下错误,所以我认为 32 位安装程序是可以使用的。
System.BadImageFormatException
任何指导将不胜感激。谢谢。