Home All Groups Group Topic Archive Search About

ConfigurationManager <-> ConfigurationSettings

Author
25 Apr 2007 11:10 AM
google
Hi,

at the moment I am about to move a WinForm application from .NET 1.x
to .NET 2.0. The application is deployed using no-touch-deployment.
The customer wants to keep this behaviour and so I cannot change it to
click-once-deployment *sigh*

However, the application requires full rights on the machine it is
running on. The developer which started the project in .NET 1.x
therefore implemented a little launcher application which raised a new
AppDomain grating full rights. The launcher application is signed to
get this working. The WinForm application now gets executed in this
new AppDomain.

This all worked fine in .NET 1.x when
ConfigurationSettings.AppSettings have been used to gather information
about the WebService location. Now I changed reading of configuration
values to ConfigurationManager.AppSettings and implemented my own
ConfigurationSection derived class (MyConfigSection) for reading the
configuration values.

Everything worked fine when running the application locally. But when
I tried to run the application via NTD the WinForm application got
loaded twice from the server. The first time when executing it in the
new AppDomain (let's call it MyClient.exe). The second time when
accessing configuration using ConfigurationManager (let's call it
MyClient.EXE - notice the different writings of "exe") . This resulted
in a InvalidCastException although the types seemed to be identical in
name and version. But after some digging I saw that the configuration
values are read via assembly MyForm.EXE and a cast is tried to the
type in assembly MyForm.exe which of course cannot be done.

When I don't use my configuration section and only use
ConfigurationManager.AppSettings again everythings works as expected.

Does somebody have any idea how to solve this?

Regards,
Michael

AddThis Social Bookmark Button