[英]Why are my .NET processes running as 32 bit when using the 64 bit installutil?
We have a C# console application that we have installed as a Windows service. 我们有一个作为Windows服务安装的C#控制台应用程序。 The target 64 bit machine is running Windows Server 2012. We used the 64 bit installutil utility:
目标64位计算机正在运行Windows Server2012。我们使用了64位installutil实用程序:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319>installutil -i C:\Services\MainService\Service.exe
However when I see the process running in the Task Manager, it shows it running as 32 bit process: 但是,当我看到任务管理器中正在运行的进程时,它显示它以32位进程的形式运行:
Any ideas why this is, and how I can get the process to run as 64 bit? 有什么想法为什么会这样,以及如何使该进程以64位运行?
I saw this question posted here, but no one has answered it yet: 我在这里看到了这个问题,但尚未有人回答:
Why is my 64 bit service running as 32 bit?
为什么我的64位服务以32位运行?
What I ended up doing was using CorFlags.exe to remove the 32BITPREF flag from the EXEs. 我最终要做的是使用CorFlags.exe从EXE删除32BITPREF标志。 I just setup a build step in TeamCity to cover this:
我只是在TeamCity中设置了一个构建步骤来解决此问题:
"C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\"CorFlags.exe Service.exe /nologo /32BITPREF-
I think the better approach would be to manually go through every project and disable that flag. 我认为更好的方法是手动检查每个项目并禁用该标志。 As someone mentioned, a simple grep and sed would most likely do the trick.
正如有人提到的,简单的grep和sed最有可能解决问题。
Clearing the "Prefer 32 Bit" flag is a better option. 清除“首选32位”标志是一个更好的选择。 This ensures that 64 bit version is compiled, and no need for custom script in the TeamCity build configuration.
这样可以确保编译64位版本,并且在TeamCity构建配置中不需要自定义脚本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.