Click here to Skip to main content
13,046,474 members (69,619 online)
Click here to Skip to main content
Add your own
alternative version


5 bookmarked
Posted 22 Aug 2008

RemotingConfiguration Unconfigure

, 1 Sep 2008
Rate this:
Please Sign up or sign in to vote.
This article is about RemotingConfiguration and how to handle it.


This article is about how to unconfigure after you have called RemotingConfiguration.Configure(<file.config>).


I found a solution for RemotingConfiguration unconfigure which is quite simple after you understand what an AppDomain is. Read some tutorials (MSDN will be the best) on how to create an AppDomain.

Using the code

First, I create an AppDomain which I use in my project. For my purposes, I have:

void Execute(string filepath, string filename)
    string exeAssembly = Assembly.GetExecutingAssembly().GetName().Name;
        AppDomainSetup ads = new AppDomainSetup();
        AppDomain ad2 = AppDomain.CreateDomain("NewDomain", null, ads);
        RemotingDomainObjects mbrt = (RemotingDomainObjects)ad2.CreateInstanceAndUnwrap(
        mbrt.DoConfiguration(filepath + filename, Session.SystemState);

Pay attention to RemotingDomainObjects and RemotingDomainObjects.DoConfiguration. Here I have:

public class RemotingDomainObjects : MarshalByRefObject
        public void DoConfiguration(string str)
            Customer obj = new Customer();
            Console.WriteLine("obj value = " + obj.get(108));
            Console.WriteLine("Press <Enter> to get the " + 
               "RemoteUnconfigure object or <Space> to exit!");

How it works

After AppDomain.Unload(ad2); is executed, all configurations on ad2 (AppDomain) are deleted. So you can configure over and over and there will be no problem. If you need additional information about my application, you can find me at


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Mircea Sirghi
Software Developer Endava, Chisinau
Moldova (Republic of) Moldova (Republic of)
Graduate: Romania, University of Bucharest, Mathematical - Informatical faculty.

You may also be interested in...

Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170713.1 | Last Updated 1 Sep 2008
Article Copyright 2008 by Mircea Sirghi
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid