473,401 Members | 2,139 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

Serious problems with ConfigurationSettings class in a web service

I have a 1.1 web service that creates multiple threads and makes an http
call within each thread. When many threads are created, the service
fails every on other call with one of these 2 errors:

(1) Parser Error Message: </b>The XML file
c:\windows\microsoft.net\framework\v1.1.4322\Confi g\machine.config could
not be loaded. Attempted to access an unloaded AppDomain.
(2) Parser Error Message: </b>The XML file
c:\windows\microsoft.net\framework\v1.1.4322\Confi g\machine.config could
not be loaded. [Resource lookup failed - infinite recursion detected.
Resource name: Arg_AppDomainUnloadedException]

When I comment out my http call block, e.g.,
using(HttpWebResponse response = http.GetResponse() as HttpWebResponse)
{
...
}
The service does not fail (as I would expect).

However, when I leave the http call in and comment out three earlier
lines that access config constants, e.g.,
string s = ConfigurationSettings.AppSettings.Get(1);
The service does not fail either.

What's even crazier is that the service takes 10X longer with the calls
to ConfigurationSettings.AppSettings (I suppose because there is some
conflict between the threads). The NameValueCollection base class
underlying the AppSettings collection says that static members of this
type are thread-safe (which AppSettings is).

Why is the ConfigurationSettings class seeming to be so hosed up here?
Dec 13 '05 #1
1 1884
I've had similar problems in the past, so I always load the
ConfigurationSettings one-time only, and this seems to fix the problem.
I did not respond right away because I, too, was waiting for a
moderator/VIP to answer. But until and unless that happens, try
this...
// these must be static...
static bool GotSettings = false;
static string SomeSetting;
// your regular ctor loads those statics...
MyClass() // ctor
{
...
if(!GotSettings)
{
SomeSetting = ConfigurationSettings.AppSettings.Get(...);
GotSettings = true;
}
}

Dec 19 '05 #2

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

Similar topics

10
by: BBFrost | last post by:
We just recently moved one of our major c# apps from VS Net 2002 to VS Net 2003. At first things were looking ok, now problems are starting to appear. So far ... (1) ...
2
by: Ireneus Broncel | last post by:
Maybe I am wrong here, but I have a problem with nant that I don't unterstand, I'm trying to compile an example ConsoleApp Project with net-1.1, and get the errror: log4net:ERROR LogLog:...
3
by: Random | last post by:
I'm writing a class library for my web app data access, but don't want to hard code the database connection string in the class. Nor do I want to pass the connection string in from the web app...
2
by: Michael Persaud | last post by:
hello, i am having problems with loading a crystal report in asp.net, below is the code, the error message. for shorts the following is bugging st = oRpt.FormatEngine.ExportToStream(req) ...
1
by: Duffman | last post by:
Hi, I have what seems to be a common problem, but the solutions I've found don't seem to work. I would like to use a web service to create a file at a UNC location in a shared file. Currently...
5
by: Simon Hart | last post by:
Hi, I want to use the ConfigurationSettings.AppSettings from within a .NET class library that gets called. If using the above class, what would the name of the config file be? would this be the...
3
by: cody | last post by:
I can't seem to get this windows service to work properly, I get a message about some services stopping automatically if they have no work to do, I suspect it may be with the way I start the timer...
4
by: rossable | last post by:
The issue is that I need to place an a tag around an image in a .xslt file. Structurally and logically I don't see why this isn't working. <td class="bluecontent_head10d" colSpan="4"> <div...
5
by: Simon | last post by:
I have problem with namespaces. I have a program that consumes the web service and has for instance names space nsProgram. In this program I have defined several classes that I use for storing and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.