Example #1
0
        static MasterService()
        {
            IEnumerable <IPEndPoint> ipEndPoints = IpEndPointReader.GetIpEndPoints().ToList();
            var appDomainSetup = new AppDomainSetup
            {
                ApplicationBase = AppDomain.CurrentDomain.BaseDirectory,
                PrivateBinPath  = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Master")
            };
            AppDomain masterDomain = AppDomain.CreateDomain("Master", null, appDomainSetup);

            master = (Master)masterDomain.CreateInstanceAndUnwrap(typeof(Master).Assembly.FullName,
                                                                  typeof(Master).FullName, false, System.Reflection.BindingFlags.Default, null,
                                                                  new object[] { ipEndPoints }, null, null);
        }
Example #2
0
        static SlaveService()
        {
            IEnumerable <IPEndPoint> ipEndPoints = IpEndPointReader.GetIpEndPoints().ToList();
            var appDomainSetup = new AppDomainSetup
            {
                ApplicationBase = AppDomain.CurrentDomain.BaseDirectory,
                PrivateBinPath  = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Slave")
            };

            foreach (var item in ipEndPoints)
            {
                AppDomain slaveDomain = AppDomain.CreateDomain("Slave" + item.Port.ToString(), null, appDomainSetup);

                _slaves.Add((Slave)slaveDomain.CreateInstanceAndUnwrap(typeof(Slave).Assembly.FullName,
                                                                       typeof(Slave).FullName, false, System.Reflection.BindingFlags.Default, null,
                                                                       new object[] { item }, null, null));
            }
        }