473,473 Members | 1,808 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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

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[s] + "<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
Nov 19 '05 #1
2 5007
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...
--
Eric Newton
eric.at.ensoft-software.com
www.ensoft-software.com
C#/ASP.net Solutions developer

"Jared Hagel" <ja*********@cpr.ca> wrote in message
news:a7**************************@posting.google.c om...
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[s] + "<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

Nov 19 '05 #2
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

ja*********@cpr.ca (Jared Hagel) wrote in message news:<a7**************************@posting.google. com>...
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[s] + "<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

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: MrFile | last post by:
I added an app.config file to my application. (c#.net component dll) <?xml version="1.0" encoding="utf-8"?> <configuration> <appSettings> <add key="username" value="xx" /> <add...
5
by: Sridhar | last post by:
Hi, I have created a project which contains classes to read the data from the database. This project has an App.Config file which contains the SqlConnection String. when this code is called from...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
4
by: PeterW | last post by:
I have a Windows service that needs to get some values from a config file. I place the config file for the service in the System32 directory. I do not get the values using the usual...
2
by: mahesh.anjani | last post by:
hi i have stored my connction string in web.config as we do usually. code of web.confing is given below. check the password field contain "&" character. now when i run my application it gives...
10
by: Brett Romero | last post by:
I'd like to store something such as the following the my app.config file: <?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings> <add key="DEBUG" value="true"/> <add...
9
by: =?Utf-8?B?TWlrZQ==?= | last post by:
Hi. Is it programatically possible in VB.NET to read the contents of web.config's <customErrorselement? I looked at using ConfigurationSettings.AppSettings, but that doesn't work. I need to...
1
by: Sergei Shelukhin | last post by:
Hi. Is is possible to divide appSetting in two, having some values stored in web.config itself and some in a section referenced in appSettings file="...." attribute?
2
by: remya1000 | last post by:
i'm using VB.NET 2003. Last time while i did a program in Vb.Net 2005, i use "Configuration". and i could read and write to that XML configuration file like the example below. CODES:...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.