public void Configure (object serverConfig)
		{
			config = serverConfig as AppServerConfig;

			physicalRoot = Environment.CurrentDirectory;

			if (config != null) {
				if (!String.IsNullOrEmpty (config.PhysycalRoot))
					physicalRoot = config.PhysycalRoot; 

				if (config.ThreadsConfig != null) {
					ThreadHelper.SetThreads (
						config.ThreadsConfig.MinWorkerThreads,
						config.ThreadsConfig.MinIOThreads,
						config.ThreadsConfig.MaxWorkerThreads,
						config.ThreadsConfig.MaxIOThreads
					);
				}

				if (!String.IsNullOrEmpty (config.HostFactoryType)) {
					Type factoryType = Type.GetType (config.HostFactoryType);
					if (factoryType == null) {
						Logger.Write (LogLevel.Error, "Could not find factory type '{0}'", config.HostFactoryType);
						return;
					}
					hostFactory = (IApplicationHostFactory)Activator.CreateInstance (factoryType);
				} else {
					hostFactory = new SystemWebHostFactory ();
				}
			}

			Logger.Write (LogLevel.Debug, "Root directory: {0}", physicalRoot);
		}
Exemple #2
0
        public void Configure(object serverConfig)
        {
            config = serverConfig as AppServerConfig;

            physicalRoot = Environment.CurrentDirectory;

            if (config != null)
            {
                if (!String.IsNullOrEmpty(config.PhysycalRoot))
                {
                    Environment.CurrentDirectory = config.PhysycalRoot;
                    physicalRoot = config.PhysycalRoot;
                }

                if (config.ThreadsConfig != null)
                {
                    ThreadHelper.SetThreads(
                        config.ThreadsConfig.MinWorkerThreads,
                        config.ThreadsConfig.MinIOThreads,
                        config.ThreadsConfig.MaxWorkerThreads,
                        config.ThreadsConfig.MaxIOThreads
                        );
                }

                if (!String.IsNullOrEmpty(config.HostFactoryType))
                {
                    Type factoryType = Type.GetType(config.HostFactoryType);
                    if (factoryType == null)
                    {
                        Logger.Write(LogLevel.Error, "Could not find factory type '{0}'", config.HostFactoryType);
                        return;
                    }
                    hostFactory = (IApplicationHostFactory)Activator.CreateInstance(factoryType);
                }
                else
                {
                    hostFactory = new SystemWebHostFactory();
                }
            }

            Logger.Write(LogLevel.Debug, "Root directory: {0}", physicalRoot);
        }