AppDomain Isolation Problem

I archived the back-end in such a way that the business logic is placed in dlls loaded at runtime. Using ShadowCopyFiles = true and file system monitoring, I can change the business logic without restarting the host process.

So far so good ...

Let us call hostdomaindomain A and one of the children of B.

Unfortunately, if I make changes to the assembly C referenced by B, but not to A, these changes are not reflected when B reboots. I assume that this is because A loads C. What steps should I take to prevent loading C?

This is the code used by A to load B:

        AppDomainSetup appDomainSetup = new AppDomainSetup();
        appDomainSetup.CachePath = ServiceDLLPath + @"\Shadow";
        appDomainSetup.ShadowCopyFiles = "true";

        ad = AppDomain.CreateDomain(assemblyName, null, appDomainSetup);
        ad.InitializeLifetimeService();
        try
        {
            service = (IService)ad.CreateInstanceFromAndUnwrap(assemblyName, 
                                  "AppName.Services." + typeName);
            service.Start();
        }
        catch (Exception e)
        {
            LogManager.Log("AppDomain load failed: " + e.Message);
            return false;
        }
+3
source share
3 answers

A C A "", C .

AppDomain, A AppDomain ( ), , , .

( , ) , A , C, , .

0

OK , "interface".

, X, :

A → X < -B- > C

(: A → B → C)

B C, , appDomain B A.

, , .

appdomain A , . , , IService:

 service = (IService)ad.CreateInstanceFromAndUnwrap(assemblyName, 
                              "AppName.Services." + typeName);

IService , B, A, - A C. , , , , .

0

When reading answers and comments, it seems that you are better off folding business logic into WCF services. You can use a clean pipe to minimize overhead for working on one PC. You should also look at MEF to create application extensibility. Unfortunately, MEF is also not designed to download and replace the plugin on the fly without restarting the host application.

0
source

All Articles