Which machine.config file is my solution using on the server?
Asked Answered
Z

1

7

I have an asp.net application that requires some editing of the machine.config file in order to work properly. On my development machine(running windows xp), I edited the machine.config file at the location: "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727"

This is the line of code I modified, with modifications(adding user/pass):

<processModel autoConfig="true" userName="SYSTEM" password="AutoGenerate">

On the server(running windows server 2003) I made the same changes to the same file at the same location. However, when I debug the solution, it does not work properly(nothing happens and it times out, the same issue I had on my development machine before making these changes to the config file).

I have come down to the fact that my application is not using the machine.config file at the same location on both my machine and the server. To confirm this, I added random numbers to the end of userName and password in both config files. On my machine, the application does not even run after I do this. On the server, it runs and errs out the same way before the random numbers were added.

My question, in short, is how do I figure out what machine.config file the server is actually using and/or how can I set it to use the one at the location mentioned?

Zurek answered 10/2, 2012 at 19:54 Comment(0)
V
12

It's possible that your server is a 64-bit server, which means it will be in:

C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727

The 64-bit runtime uses a different machine.config. The basic rules are this:

  1. ASP.NET 1.x uses %WINDIR%\Microsoft.NET\Framework\v1.1.4322
  2. ASP.NET 2.0 / 3.5 x86 uses %WINDIR%\Microsoft.NET\Framework\v2.0.50727
  3. ASP.NET 2.0 / 3.5 x64 uses %WINDIR%\Microsoft.NET\Framework64\v2.0.50727
  4. ASP.NET 4.0 / 4.5.x x86 uses %WINDIR%\Microsoft.NET\Framework\v4.0.30319
  5. ASP.NET 4.0 / 4.5.x x64 uses %WINDIR%\Microsoft.NET\Framework64\v4.0.30319
  6. For ASP.NET 5.0 using the Full CLR, this will be the same as the ASP.NET 4.0 locations since the .NET Framework 4.6 is a drop in replacement for 4.5. If ASP.NET 5.0 is running on the CoreCLR, there is no concept of a machine.config file.

Which version of ASP.NET you use depends on your ASP.NET Tab (IIS 6) or AppPool (IIS 7+)

x64 vs. x86 depends on the metadata setting W3SVC/AppPools/Enable32BitAppOnWin64 for IIS 6, or the AppPool in IIS 7.

Vonnie answered 10/2, 2012 at 19:57 Comment(3)
Both machines are 32-bit, I just confirmed this. +1 for something I hadn't considered thoughZurek
@Zurek I suppose you could use the code ConfigurationManager.OpenMachineConfiguration().FilePath to figure out where it is looking for the machine.config. You'll need to reference System.Configuration assembly.Vonnie
Hm, it shows as the same location on both machine. I guess my conjecture was wrong. Perhaps my project is somehow not referencing the updated version(I know you have to restart IIS Admin Service, and I have). You proved my conjecture wrong, but answered my question. Thanks for your help.Zurek

© 2022 - 2024 — McMap. All rights reserved.