Can't read the appSettings section of web.config (Windows Server 2003)

  • Thread starter Thread starter Jared Hagel
  • Start date Start date
J

Jared Hagel

I've searched the web for a solution to this problem. Surprisingly, no
problem/solution has been posted yet.

We can read application configuration information fine when our
asp.net application runs on a Windows 2000 server. But when we run
this same application from Windows 2003, we can't read any application
configuration.

The code in question is this (in default.aspx):

private void Page_Load(object sender, EventArgs e)
{
NameValueCollection sAll = ConfigurationSettings.AppSettings;

foreach (string s in sAll.AllKeys)
{
Response.Write ("Key: " + s + " Value: " + sAll + "<br>");
}

Response.End ();
}

In web.config, we have this:
<appSettings>
<add key="key" value="value"/>
</appSettings>

This code correctly writes the following to the browser on Windows
2000:
Key: key Value: value

On Windows Server 2003 nothing is written.

We configured w3wp.exe (asp.net worker process on Windows 2003) to run
with administrator access, but this didn't fix things. We changed the
ACL of web.config to grant various different AD ids read/write
privileges, but this also didn't solve the problem.

Anybody have any suggestions?

Thanks,
Jared
 
1. change the aspnet_wp BACK to aspnet userid immediately!

2. look in the machine.config file, verify that the appsettings sectiongroup
is defined.

also try removing / reinstalling asp.net on the 2003 server...
 
This problem occurs for me in the simplest scenario.

I wrote a web application with the following code in default.aspx:

private void Page_Load(object sender, System.EventArgs e)
{
Label1.Text = ConfigurationSettings.AppSettings["LabelText"];
}

web.config contains:

<appSettings>
<add key="LabelText" value="test passed"/>
</appSettings>

This label isn't being displayed with the value "test passed" in
Windows Server 2003! Only on Windows 2000.

I'm stumped. Does anybody have any suggestions?

Thanks,
Jared
 
Back
Top