By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,222 Members | 1,079 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,222 IT Pros & Developers. It's quick & easy.

ConfigurationManager.OpenExeConfiguration opening wrong file?

P: n/a
Hi,

I have an application that loads various settings from the
app.exe.config file. This has worked very well on w2k, XP, and
Vista.

However, recently I've been troubleshooting an issue on Windows Home
Server (which is based on some variation of Windows Server 2003) and
I've found that
ConfigurationManager.OpenExeConfiguration(Configur ationUserLevel) is
opening the wrong file. Not only is it opening the wrong file, but
it's a file that doesn't even exist in the directory.

For example, I installed our application to:

C:\Program Files\My App Name\app.exe

....along with all of the supporting files, and our config file,
app.exe.config. Normally, I see
ConfigurationManager.OpenExeConfiguration return a local user
configuration path of C:\Program Files\My App Name\app.exe.config.
However, under Windows Server 2003, the call returns C:\Program Files
\My App Name\app.config which is a file that:

1. Doesn't exist, and
2. Doesn't contain any of the configuration information that my
application needs to function.

For both calls, the parameter is ConfigurationUserLevel.None.

I haven't tried loading our application on Windows Server 2003 to see
if the issue also reproduces there. I did some searching to see if
people have had any previous problems with OpenExeConfiguration, and
it seems like a lot of people have had problems where an extra
".config" was appended (e.g. it returns "app.exe.config.config") but I
haven't seen any reports of it omitting the ".exe".

Does anyone have any idea what's going on here? Thanks in advance.

Jul 19 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.