Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I have two machine.config files on my server, which one do I edit and how do I verify they are being used?

I need to do some performance tuning and need to modify the following settings: processModel, httpRuntime, and connectionManagement. Simple enough I suppose, but I'm not sure which of the two machine.config files to edit, or do I edit both?

  • \Windows\microsoft.net\ Framework \v2.0.50727\CONFIG\machine.config
  • \Windows\microsoft.net\ Framework64 \v2.0.50727\CONFIG\machine.config

As a follow up question, how do I verify that the settings have been applied?

I should mention that the server is running Windows Server 2003 Enterprise (64-bit) with IIS 6.0 (64-bit) and MSSQL Server Enterprise 2005 (64-bit).

Thanks for the help in advance!

like image 778
John Avatar asked Jul 15 '10 15:07

John


People also ask

Can we have multiple config files?

Yes you can have two web. config files in application. There are situations where your application is divided in to modules and for every module you need separate configuration.

How can I use two web config in one file?

You can have 1 Web. config file per folder . So in your root you can have a web. config and in a subfolder you can have another one that overrides settings from the one in the root.

Which machine config is used?

The machine. config file is stored in the %WINDIR%\Microsoft.NET\Framework folder in the directory where Microsoft Windows is installed. By default, it is located in the following path: C:\WINDOWS\Microsoft.NET\Framework\v1. 1.4322\CONFIG.

How do I access machine config file?

Open the Machine. config file in a text editor such as Notepad. The Machine. config file is located in the %SystemRoot%\Microsoft.NET\Framework\%VersionNumber%\CONFIG\ directory.


2 Answers

The one located in Framework64 is being used if your .net application/IIS is running in 64 bit mode. The other is used if running in 32 bit mode.

When bringing up the Windows Task Manager, if there's "*32" appended to the process name, then it runs in 32 bit. If not it runs under 64 bit.

If your OS is 64bit that is, something I assume since you have both folders on your machine.

If you are using IIS6/7, the process is named w3wp.exe.

IIS7 has more settings for this as well which can be read at this blog post.

like image 148
Mikael Svenson Avatar answered Oct 22 '22 10:10

Mikael Svenson


Personally I would edit neither, but instead modify the web.config files at site or application level.

You should be able to modify httpRuntime and connectionManagement settings in this way, but not processModel, which can only be used in machine.config.

However you may not need to modify processModel if you are on Windows Server 2003.

As others have pointed out, if you do want to modify machine.config, IIS6 will run in 64-bit mode by default, so that's the version to edit. If you need to run in 32-bit mode (e.g. because you need to use 32-bit native DLLs), you can configure 32-bit mode as follows:

cscript.exe adsutil.vbs set W3SVC/AppPools/Enable32BitAppOnWin64 "true"

See this TechNet article for more info.

like image 20
Joe Avatar answered Oct 22 '22 10:10

Joe