.net Machine.Config 在哪里?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2325473/
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
Where Is Machine.Config?
提问by Hyman Kada
I want to apply a change so That I can use Server GC settings for my C# 3.5 app - I can do that by editing the machine.configfile.
我想应用更改以便我可以为我的 C# 3.5 应用程序使用服务器 GC 设置 - 我可以通过编辑machine.config文件来做到这一点。
The only problem is I do not know where that is.
唯一的问题是我不知道那是哪里。
How can I find the path of this file in a repeatable way across a number of different machines
如何在许多不同的机器上以可重复的方式找到这个文件的路径
回答by Peter
32-bit
32 位
%windir%\Microsoft.NET\Framework\[version]\config\machine.config
64-bit
64 位
%windir%\Microsoft.NET\Framework64\[version]\config\machine.config
[version]should be equal to v1.0.3705, v1.1.4322, v2.0.50727or v4.0.30319.
[version]应等于v1.0.3705,v1.1.4322,v2.0.50727或v4.0.30319。
v3.0and v3.5just contain additional assemblies to v2.0.50727so there should be no config\machine.config. v4.5.xand v4.6.xare stored inside v4.0.30319.
v3.0并且v3.5只包含额外的程序集,v2.0.50727所以应该没有config\machine.config. v4.5.x并v4.6.x存储在v4.0.30319.
回答by Daniel Little
You can run this in powershell:
您可以在 powershell 中运行它:
[System.Runtime.InteropServices.RuntimeEnvironment]::SystemConfigurationFile
Which outputs this for .net 4:
为 .net 4 输出这个:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config
Note however that this might change depending on whether .net is running as 32 or 64 bit which will result in \Framework\or \Framework64\respectively.
但是请注意,这可能会根据 .net 是作为 32 位还是 64 位运行而改变,这将分别导致\Framework\或\Framework64\。
回答by DiningPhilanderer
In order to be absolutely sure, slap a Label on an ASP.NET page and run this code:
为了绝对确定,在 ASP.NET 页面上贴一个标签并运行以下代码:
labelDebug.Text = System.Runtime.InteropServices.RuntimeEnvironment.SystemConfigurationFile;
I believe this will leave no doubt!
我相信这将毫无疑问!
回答by Timothy Khouri
It semi-depends though... mine is:
不过,它半取决于……我的是:
C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG
C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG
and
和
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\CONFIG
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\CONFIG
回答by John Saunders
C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG
C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG
回答by Saikat Chakraborty
- Open Windows Run command. Shortcut=> windows key + r
- Type "microsoft.net" - MS .Net folder opens up
- Open "Framework"/"Framework64" folder(based on your processor).
- Select specific FW version folder e.g. "v4.0.30319"
- Open config folder
- Machine.config will be available there. Cheers.
- 打开 Windows 运行命令。快捷键=> windows 键 + r
- 输入“microsoft.net” - MS .Net 文件夹打开
- 打开“Framework”/“Framework64”文件夹(基于您的处理器)。
- 选择特定的固件版本文件夹,例如“v4.0.30319”
- 打开配置文件夹
- Machine.config 将在那里可用。干杯。
回答by Hosein Djadidi
In your asp.net app use this
在您的 asp.net 应用程序中使用此
using System.Configuration;
Response.Write(ConfigurationManager.OpenMachineConfiguration().FilePath);
回答by lazydeveloper
You can run this in powershell: copy & paste in power shell [System.Runtime.InteropServices.RuntimeEnvironment]::SystemConfigurationFile
您可以在 powershell 中运行它:复制并粘贴到 powershell [System.Runtime.InteropServices.RuntimeEnvironment]::SystemConfigurationFile
mine output is: C:\Windows\Microsoft.NET\Framework\v2.0.50527\config\machine.config
我的输出是:C:\Windows\Microsoft.NET\Framework\v2.0.50527\config\machine.config

