Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows services Windows服务安装.NET-4.5无法加载exe文件_Windows Services_.net 4.5_Installutil - Fatal编程技术网

Windows services Windows服务安装.NET-4.5无法加载exe文件

Windows services Windows服务安装.NET-4.5无法加载exe文件,windows-services,.net-4.5,installutil,Windows Services,.net 4.5,Installutil,我正在尝试在cmd中安装带有installutil的windows服务,这是我得到的消息: 初始化安装时发生异常: System.BadImageFormatException:无法加载文件或程序集的file:///D:\仪表 “所有\DemoWinProject.exe”或其依赖项之一。该模块应包含一个 程序集清单 你能帮我找出什么是prb吗?我还没有直接看到这个问题,但经过一次非常简短的搜索,可能找到了你想要的答案。简而言之,请确保针对应用程序所针对的.NET framework使用的Ins

我正在尝试在cmd中安装带有installutil的windows服务,这是我得到的消息:

初始化安装时发生异常: System.BadImageFormatException:无法加载文件或程序集的file:///D:\仪表 “所有\DemoWinProject.exe”或其依赖项之一。该模块应包含一个 程序集清单


你能帮我找出什么是prb吗?

我还没有直接看到这个问题,但经过一次非常简短的搜索,可能找到了你想要的答案。简而言之,请确保针对应用程序所针对的.NET framework使用的InstallUtil.exe版本正确,并且程序集中没有任何x86/x64不一致

FWIW,我个人不喜欢使用InstallUtil.exe来安装我的Windows服务;我更喜欢Windows服务自行执行安装/卸载。正如我所展示的,这是一件相当简单的事情


HTH.

我通过写入InstallUtil.exe所在的路径,然后写入InstallUtil命令,然后写入需要安装的exe文件所在的路径,修复了此问题

注意:在另一个地方复制调试文件夹,并从该路径安装exe文件。这是因为,无论何时进行编译,exe文件都会发生更改。因此,为了防止对已安装的.exe进行更改,请在其他位置复制并安装它

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727>installutil c:\Documents\Debug\WindowsService.exe