protected AppServerMetadata GetServerTypeMetadata(string serviceTypeName) { AppDomain validateDomain = null; AppServerMetadata metadata = null; try { validateDomain = AppDomain.CreateDomain("ValidationDomain", AppDomain.CurrentDomain.Evidence, AppDomain.CurrentDomain.BaseDirectory, string.Empty, false); AssemblyImport.RegisterAssembplyImport(validateDomain); var validatorType = typeof(TypeValidator); var validator = (TypeValidator)validateDomain.CreateInstanceAndUnwrap(validatorType.Assembly.FullName, validatorType.FullName); metadata = validator.GetServerTypeMetadata(serviceTypeName); } finally { if (validateDomain != null) { AppDomain.Unload(validateDomain); } } return(metadata); }
public bool Setup(string serverType, string bootstrapUri, string assemblyImportRoot, IServerConfig config, ProviderFactoryInfo[] factories) { m_AssemblyImporter = new AssemblyImport(assemblyImportRoot); var serviceType = Type.GetType(serverType); m_AppServer = (IWorkItem)Activator.CreateInstance(serviceType); var bootstrap = (IBootstrap)Activator.GetObject(typeof(IBootstrap), bootstrapUri); return m_AppServer.Setup(bootstrap, config, factories); }
public bool Setup(string serverType, string bootstrapUri, string assemblyImportRoot, IServerConfig config) { m_AssemblyImporter = new AssemblyImport(assemblyImportRoot); var serviceType = Type.GetType(serverType); m_AppServer = (IManagedApp)Activator.CreateInstance(serviceType); var bootstrap = (IBootstrap)Activator.GetObject(typeof(IBootstrap), bootstrapUri); var ret = m_AppServer.Setup(bootstrap, config); if (ret) { m_Log = ((IAppServer)m_AppServer).Logger; AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); } return ret; }
public bool Setup(string serverType, string bootstrapUri, string assemblyImportRoot, IServerConfig config, ProviderFactoryInfo[] factories, string startupConfigFile) { m_AssemblyImporter = new AssemblyImport(assemblyImportRoot); if (!string.IsNullOrEmpty(startupConfigFile)) { AppDomain.CurrentDomain.ResetConfiguration(startupConfigFile); } var serviceType = Type.GetType(serverType); m_AppServer = (IWorkItem)Activator.CreateInstance(serviceType); var bootstrap = (IBootstrap)Activator.GetObject(typeof(IBootstrap), bootstrapUri); var ret = m_AppServer.Setup(bootstrap, config, factories); if (ret) { m_Log = ((IAppServer)m_AppServer).Logger; AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); } return ret; }