コード例 #1
0
        private IApplicationHost CreateAppHost(Type appHostType, object appHostConfig,
                                               WebAppConfig appConfig,
                                               IListenerTransport listenerTransport, Type appHostTransportType, object appHostTransportConfig)
        {
            Logger.Write(LogLevel.Debug, "SimpleApplicationServer.CreateAppHost vhost={0}, vport={1}", appConfig.VHost, appConfig.VPort);
            try
            {
                IApplicationHost host = hostFactory.CreateApplicationHost(appHostType, appConfig.VHost, appConfig.VPort, appConfig.VPath, appConfig.RealPath);
                host.Configure(appHostConfig, appConfig, this, listenerTransport, appHostTransportType, appHostTransportConfig);
                //subscribe to Unload event only after run host.Configure
                //because apphost transport must unregister himself first
                host.HostUnload += OnHostUnload;

                lock (hosts) {
                    hosts.Add(new HostInfo()
                    {
                        Host                   = host,
                        AppHostType            = appHostType,
                        AppHostConfig          = appHostConfig,
                        AppConfig              = appConfig,
                        ListenerTransport      = listenerTransport,
                        AppHostTransportType   = appHostTransportType,
                        AppHostTransportConfig = appHostTransportConfig
                    });
                }
                return(host);
            } catch (Exception ex) {
                Logger.Write(LogLevel.Error, "Can't create host {0}", ex);
                return(null);
            }
        }
コード例 #2
0
		public void Configure(object conf, IApplicationServer server, 
			Type listenerTransport, object listenerTransportConfig,
			Type appHostTransport, object appHostTransportConfig)
		{
			this.server = server;
			this.config = conf as ListenerConfig;

			transport = (IListenerTransport)Activator.CreateInstance (listenerTransport);
			transport.Configure (this, listenerTransportConfig);

			appHostTransportType = appHostTransport;
		}
コード例 #3
0
        public void Configure(object conf, IApplicationServer server,
                              Type listenerTransport, object listenerTransportConfig,
                              Type appHostTransport, object appHostTransportConfig)
        {
            this.server = server;
            this.config = conf as ListenerConfig;

            transport = (IListenerTransport)Activator.CreateInstance(listenerTransport);
            transport.Configure(this, listenerTransportConfig);

            appHostTransportType = appHostTransport;
        }
コード例 #4
0
        public IApplicationHost CreateApplicationHost(Type appHostType, object appHostConfig,
                                                      object webAppConfig,
                                                      IListenerTransport listenerTransport, Type appHostTransportType, object appHostTransportConfig)
        {
            WebAppConfig appConfig = webAppConfig as WebAppConfig;

            if (appConfig == null)
            {
                Logger.Write(LogLevel.Error, "Web application is not specified");
                return(null);
            }

            return(CreateAppHost(appHostType, appHostConfig, appConfig, listenerTransport, appHostTransportType, appHostTransportConfig));
        }
コード例 #5
0
		public override void Configure (object appHostConfig, object webAppConfig, 
			IApplicationServer server, 
			IListenerTransport listenerTransport, 
			Type appHostTransportType, object transportConfig)
		{
			AspNetHostConfig config = appHostConfig as AspNetHostConfig;

			if (config != null) {
				LogLevel = config.Log.Level;
				LogToConsole = config.Log.WriteToConsole;
				AddTrailingSlash = config.AddTrailingSlash;
			}

			base.Configure (appHostConfig, webAppConfig, server, listenerTransport, appHostTransportType, transportConfig);
		}
コード例 #6
0
        public override void Configure(object appHostConfig, object webAppConfig,
                                       IApplicationServer server,
                                       IListenerTransport listenerTransport,
                                       Type appHostTransportType, object transportConfig)
        {
            AspNetHostConfig config = appHostConfig as AspNetHostConfig;

            if (config != null)
            {
                LogLevel         = config.Log.Level;
                LogToConsole     = config.Log.WriteToConsole;
                AddTrailingSlash = config.AddTrailingSlash;
            }

            base.Configure(appHostConfig, webAppConfig, server, listenerTransport, appHostTransportType, transportConfig);
        }
コード例 #7
0
ファイル: AppHostBase.cs プロジェクト: rusvdw/HyperFastCgi
		public virtual void Configure (object appHostConfig, object webAppConfig, 
			IApplicationServer server, 
			IListenerTransport listenerTransport, 
			Type appHostTransportType, object transportConfig)
		{
			WebAppConfig appConfig = webAppConfig as WebAppConfig;
			if (appConfig != null) {
				vport = appConfig.VPort;
				vhost = appConfig.VHost;
				vpath = appConfig.VPath;
				path = appConfig.RealPath;
			}

			appServer = server;
			this.listenerTransport = listenerTransport;
			appHostTransport = (IApplicationHostTransport) Activator.CreateInstance (appHostTransportType);
			appHostTransport.Configure (this, transportConfig);
		}
コード例 #8
0
		public virtual void Configure (object appHostConfig, object webAppConfig, 
			IApplicationServer server, 
			IListenerTransport listenerTransport, 
			Type appHostTransportType, object transportConfig)
		{
			WebAppConfig appConfig = webAppConfig as WebAppConfig;
			if (appConfig != null) {
				vport = appConfig.VPort;
				vhost = appConfig.VHost;
				vpath = appConfig.VPath;
				path = appConfig.RealPath;
			}

			appServer = server;
			physicalRoot = server.PhysicalRoot;
			this.listenerTransport = listenerTransport;
			appHostTransport = (IApplicationHostTransport) Activator.CreateInstance (appHostTransportType);
			appHostTransport.Configure (this, transportConfig);
			Logger.Write (LogLevel.Debug, "Configured host in domain {0}, id={1}", AppDomain.CurrentDomain.FriendlyName, AppDomain.CurrentDomain.Id);
		}
コード例 #9
0
ファイル: AppHostBase.cs プロジェクト: tonyozr/HyperFastCgi
        public virtual void Configure(object appHostConfig, object webAppConfig,
                                      IApplicationServer server,
                                      IListenerTransport listenerTransport,
                                      Type appHostTransportType, object transportConfig)
        {
            WebAppConfig appConfig = webAppConfig as WebAppConfig;

            if (appConfig != null)
            {
                vport = appConfig.VPort;
                vhost = appConfig.VHost;
                vpath = appConfig.VPath;
                path  = appConfig.RealPath;
            }

            appServer = server;
            this.listenerTransport = listenerTransport;
            appHostTransport       = (IApplicationHostTransport)Activator.CreateInstance(appHostTransportType);
            appHostTransport.Configure(this, transportConfig);
        }
コード例 #10
0
ファイル: RawHost.cs プロジェクト: qinfengzhu/HyperFastCgi
		public override void Configure (object appHostConfig, object webAppConfig,
			IApplicationServer server, 
			IListenerTransport listenerTransport, 
			Type appHostTransportType, object transportConfig)
		{
			RawHostConfig config = appHostConfig as RawHostConfig;

			if (config != null) {
				Logger.Level = config.Log.Level;
				Logger.WriteToConsole = config.Log.WriteToConsole;

				requestType = Type.GetType(config.RequestType);
				if (requestType == null) {
					Logger.Write(LogLevel.Error, "Couldn't find type '{0}'", config.RequestType);
					throw new ArgumentException ("appHostConfig.Type");
				}
				CreateRequestInstance = CreateDynamicMethod (requestType);
			}

			base.Configure (appHostConfig, webAppConfig, server, listenerTransport, appHostTransportType, transportConfig);
		} 
コード例 #11
0
        public virtual void Configure(object appHostConfig, object webAppConfig,
                                      IApplicationServer server,
                                      IListenerTransport listenerTransport,
                                      Type appHostTransportType, object transportConfig)
        {
            WebAppConfig appConfig = webAppConfig as WebAppConfig;

            if (appConfig != null)
            {
                vport = appConfig.VPort;
                vhost = appConfig.VHost;
                vpath = appConfig.VPath;
                path  = appConfig.RealPath;
            }

            appServer              = server;
            physicalRoot           = server.PhysicalRoot;
            this.listenerTransport = listenerTransport;
            appHostTransport       = (IApplicationHostTransport)Activator.CreateInstance(appHostTransportType);
            appHostTransport.Configure(this, transportConfig);
            Logger.Write(LogLevel.Debug, "Configured host in domain {0}, id={1}", AppDomain.CurrentDomain.FriendlyName, AppDomain.CurrentDomain.Id);
        }
コード例 #12
0
ファイル: RawHost.cs プロジェクト: yufeixuan/HyperFastCgi
        public override void Configure(object appHostConfig, object webAppConfig,
                                       IApplicationServer server,
                                       IListenerTransport listenerTransport,
                                       Type appHostTransportType, object transportConfig)
        {
            RawHostConfig config = appHostConfig as RawHostConfig;

            if (config != null)
            {
                Logger.Level          = config.Log.Level;
                Logger.WriteToConsole = config.Log.WriteToConsole;

                requestType = Type.GetType(config.RequestType);
                if (requestType == null)
                {
                    Logger.Write(LogLevel.Error, "Couldn't find type '{0}'", config.RequestType);
                    throw new ArgumentException("appHostConfig.Type");
                }
                CreateRequestInstance = CreateDynamicMethod(requestType);
            }

            base.Configure(appHostConfig, webAppConfig, server, listenerTransport, appHostTransportType, transportConfig);
        }
コード例 #13
0
		private IApplicationHost CreateAppHost(Type appHostType, object appHostConfig, 
			WebAppConfig appConfig, 
			IListenerTransport listenerTransport, Type appHostTransportType, object appHostTransportConfig)
		{
			try
			{
				IApplicationHost host = hostFactory.CreateApplicationHost (appHostType, appConfig.VHost, appConfig.VPort, appConfig.VPath, appConfig.RealPath);
				host.Configure (appHostConfig, appConfig, this, listenerTransport, appHostTransportType, appHostTransportConfig);
				//subscribe to Unload event only after run host.Configure
				//because apphost transport must unregister himself first
				host.HostUnload += OnHostUnload;

				lock (hosts) {
					hosts.Add (new HostInfo () {
						Host = host,
						AppHostType = appHostType,
						AppHostConfig = appHostConfig,
						AppConfig = appConfig,
						ListenerTransport = listenerTransport,
						AppHostTransportType = appHostTransportType,
						AppHostTransportConfig = appHostTransportConfig
					});
				}
				return host;
			} catch (Exception ex) {
				Logger.Write (LogLevel.Error, "Can't create host {0}", ex);
				return null;
			}

		}
コード例 #14
0
		public IApplicationHost CreateApplicationHost(Type appHostType, object appHostConfig, 
			object webAppConfig, 
			IListenerTransport listenerTransport, Type appHostTransportType, object appHostTransportConfig)
		{
			WebAppConfig appConfig = webAppConfig as WebAppConfig;

			if (appConfig == null) {
				Logger.Write (LogLevel.Error, "Web application is not specified");
				return null;
			}

			return CreateAppHost (appHostType, appHostConfig, appConfig, listenerTransport, appHostTransportType, appHostTransportConfig);
		}