简体   繁体   English

为什么在使用64位installutil时我的.NET进程以32位运行?

[英]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位进程的形式运行:

Snapshot_of_task_manager_32bit_process

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最有可能解决问题。


Update 更新资料

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.

相关问题 为什么我的64位服务运行为32位? - Why is my 64 bit service running as 32 bit? 使用64位项目的32位库 - .NET - Using 32 bit library from 64 bit project - .NET 我的 32 位头痛现在是 64 位偏头痛??? (或 64 位 .NET CLR 运行时问题) - My 32 bit headache is now a 64bit migraine?!? (or 64bit .NET CLR Runtime issues) 将 .net 应用程序 32 位转换为 64 位 - converting .net application 32 bit to 64 bit 为什么我的应用程序(我使用Any CPU编译)在我的64位计算机上作为32位进程运行? - Why is my application, which I compiled with Any CPU, running as a 32-bit process on my 64-bit machine? 为什么64位比32位更快? - Why is this faster on 64 bit than 32 bit? 为什么我能够从以 64 位模式在 IIS7 中运行的 AnyCPU .NET web 应用程序调用 32 位 COM 库? - Why am I able to call a 32 bit COM library from an AnyCPU .NET web application running in IIS7 in 64 bit mode? 32 位进程无法使用 C# 访问 64 位进程的模块 - A 32 bit processes cannot access modules of a 64 bit process using C# 检查我的程序是否在64位机器上以32位模式运行,如果以64位运行 - 如何强制它为32位 - Check if my program is running in 32 bit mode on a 64bit machine, if running in 64bit - how do I force it to be 32bit 如何判断我的应用程序是作为32位还是64位应用程序运行? - How do I tell if my application is running as a 32-bit or 64-bit application?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM