ConfigurationSettings.AppSettings always returns null

A

Andrew Hayes

I'm not using One Touch or OpenNetCF, so none of the workarounds offered by
those search results work.

What I do have is a .NET 1.1 EXE which runs as a service on a machine
without IIS, and it used to work fine until I had to install .NET 2.0 because
of another application being installed. Now the call to
ConfigurationSettings.AppSettings always returns NULL.

I've tried adding the AppSettings section to the .NET 2.0. machine.config
and web.config files but with no change in the result. I've also tried
creating the appname.exe.config file in the same folder as the EXE, but that
doesn't help either.

Yes, I know ConfigurationSettings.AppSettings is obsolete so I should really
change the code and recompile it but I don't have VS 2005 (what's the point
of upgrading now when VS 2008 is just around the corner?)

So can anyone tell me where ConfigurationSettings.AppSettings is looking
when both .NET 1.1 and .NET 2.0 are installed? Or any other workaround that
would actually work?
 
A

Alan Samet

I'm not using One Touch or OpenNetCF, so none of the workarounds offered by
those search results work.

What I do have is a .NET 1.1 EXE which runs as a service on a machine
without IIS, and it used to work fine until I had to install .NET 2.0 because
of another application being installed. Now the call to
ConfigurationSettings.AppSettings always returns NULL.

I've tried adding the AppSettings section to the .NET 2.0. machine.config
and web.config files but with no change in the result. I've also tried
creating the appname.exe.config file in the same folder as the EXE, but that
doesn't help either.

Yes, I know ConfigurationSettings.AppSettings is obsolete so I should really
change the code and recompile it but I don't have VS 2005 (what's the point
of upgrading now when VS 2008 is just around the corner?)

So can anyone tell me where ConfigurationSettings.AppSettings is looking
when both .NET 1.1 and .NET 2.0 are installed? Or any other workaround that
would actually work?

AppDomain.CurrentDomain.SetupInformation.ConfigurationFile
 

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

Top