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

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
 
E

Eric Newton

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...
 
J

Jared Hagel

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,227
Latest member
Daniella65

Latest Threads

Top