如何使 .NET 应用程序“识别大地址”?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1346480/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 13:13:27  来源:igfitidea点击:

How to make a .NET application "large address aware"?

.netwindowsmemory

提问by wildcard

Assuming I have booted a 32-bit Windows Server with the /3GB switch, how can I make a .NET application use the additional address space?

假设我已经用 /3GB 开关启动了一个 32 位的 Windows Server,我怎样才能让 .NET 应用程序使用额外的地址空间?

回答by Brian Rasmussen

The flag is part of the image header, so you need to modify that using editbin.

该标志是图像标题的一部分,因此您需要使用 editbin 对其进行修改。

editbin /LARGEADDRESSAWARE <your exe>

Use dumpbin /headersand look for the presence of Application can handle large (>2GB) addressesto see if the flag is set or not.

使用dumpbin /headers并查找 的存在Application can handle large (>2GB) addresses以查看是否设置了标志。

回答by WildCrustacean

From what I can tell you have to use the editbin utility shown in the existing answer. There does not appear to be any way to set the flag using Visual Studio .NET, it looks like they encourage people to compile for 64 bit if possible instead of using the flag

据我所知,您必须使用现有答案中显示的 editbin 实用程序。似乎没有任何方法可以使用 Visual Studio .NET 设置标志,看起来他们鼓励人们尽可能编译 64 位而不是使用标志

http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=93771

http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=93771

回答by Thomas

For doing it automaticaly from Visual studio, please refer to this question : flag from visual studio.

要从 Visual Studio 自动执行此操作,请参阅此问题:来自 Visual Studio 的 标志

回答by Pedro77

Add those lines to Post build:

将这些行添加到 Post build:

call "$(DevEnvDir)..\tools\vsdevcmd.bat"
editbin /largeaddressaware "$(TargetPath)"

From: vsvars32.bat in Visual Studio 2017

来自:Visual Studio 2017 中的 vsvars32.bat