如何在 64 位 Windows Server 2008 上从 32 位 .NET 应用程序启动 ServerManager.msc?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2447883/
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-15 14:07:10  来源:igfitidea点击:

How can I start ServerManager.msc on a 64bit Windows Server 2008 from a 32bit .NET App?

c#.netwindows64-bitwow64

提问by mkva

I have the following scenario:
- 64bit Windows Server 2008.
- 32bit .NET application (needs to be x86 for various reasons).
- I need to start ServerManager.msc from my .NET application.

我有以下场景:
- 64 位 Windows Server 2008。
- 32 位 .NET 应用程序(由于各种原因需要为 x86)。
- 我需要从我的 .NET 应用程序启动 ServerManager.msc。

When using Process.Start("ServerManager.msc"), I get the following exception:
System.ComponentModel.Win32Exception.
Message="The system cannot find the file specified".

使用 Process.Start("ServerManager.msc") 时,出现以下异常:
System.ComponentModel.Win32Exception。
Message="系统找不到指定的文件"。

On a 32bit Windows Server 2008 the code works fine...
I tried to inlcude the full path to ServerManager.msc, but that does not help either.
Also no difference if running with or without admin privileges.

在 32 位 Windows Server 2008 上,代码运行良好......
我试图包含 ServerManager.msc 的完整路径,但这也无济于事。
使用或不使用管理员权限运行也没有区别。

Any ideas?

有任何想法吗?

采纳答案by Roger Lipscombe

On WOW64, if a 32-bit application refers to C:\Windows\System32; the operating system transparently remaps this to C:\Windows\SysWOW64 (which is where the 32-bit stuff lives).

在 WOW64 上,如果 32 位应用程序引用 C:\Windows\System32;操作系统透明地将其重新映射到 C:\Windows\SysWOW64(这是 32 位内容所在的位置)。

As a 32-bit application on Win64, you need to specify the full path as %SYSTEMROOT%\SysNative\ServerManager.msc.

作为 Win64 上的 32 位应用程序,您需要将完整路径指定为%SYSTEMROOT%\SysNative\ServerManager.msc.

SysNativedoesn't exist on x86 Windows (there's no reverse mapping, at least on Win7 Ultimate), so you'll need to figure out whether you're on x86 or x64 first.

SysNative在 x86 Windows 上不存在(至少在 Win7 Ultimate 上没有反向映射),因此您需要先确定您是在 x86 还是 x64 上。

回答by Vivek

Please use depends.exeto find out which file/dll is missing.

请使用depends.exe找出缺少哪个文件/dll。

If it is using an x86 native dll/library which is compiled in newer version of VC++ Runtime. Install the latest VC++ runtime on the 2008 server. Latest I believe is 2008 SP1.

如果它使用的是在较新版本的 VC++ 运行时中编译的 x86 本机 dll/库。在 2008 服务器上安装最新的 VC++ 运行时。最新的我相信是2008 SP1