예제 #1
0
 private void CreateAppDomain()
 {
     try
     {
         appDomain = AppDomainUtils.CreateAppDomain(@"IsolatedAppDomainHost",
                                                    HostSetup.ApplicationBaseDirectory, temporaryConfigurationFilePath, HostSetup.ShadowCopy);
     }
     catch (Exception ex)
     {
         throw new HostException("Could not create the isolated AppDomain.", ex);
     }
 }
예제 #2
0
        /// <inheritdoc />
        protected override IRemoteHostService AcquireRemoteHostService()
        {
            try
            {
                SetWorkingDirectory();
                CreateTemporaryConfigurationFile();
                CreateAppDomain();
                AttachDebuggerIfNeeded(debuggerManager, Process.GetCurrentProcess());

                var endpoint = (IsolatedAppDomainEndpoint)AppDomainUtils.CreateRemoteInstance(appDomain, typeof(IsolatedAppDomainEndpoint));

                foreach (string hintDirectory in HostSetup.HintDirectories)
                {
                    endpoint.AddHintDirectory(hintDirectory);
                }

                return(endpoint.CreateRemoteHostService(null));
            }
            catch (Exception)
            {
                FreeResources();
                throw;
            }
        }