コード例 #1
0
        public bool Start(bool bgThread, int backlog)
        {
            if (started)
            {
                throw new InvalidOperationException("The server is already started.");
            }

            if (vpathToHost == null)
            {
                throw new InvalidOperationException("SetApplications must be called first.");
            }

            if (SingleApplication)
            {
                var v     = vpathToHost [0];
                v.AppHost = AppHost;
                // Link the host in the application domain with a request broker in the *same* domain
                // Not needed for SingleApplication and mod_mono
                v.RequestBroker       = webSource.CreateRequestBroker();
                AppHost.RequestBroker = v.RequestBroker;
            }

            listen_socket = webSource.CreateSocket();
            listen_socket.Listen(backlog);
            runner = new Thread(RunServer)
            {
                IsBackground = bgThread
            };
            runner.Start();
            stop = false;
            return(true);
        }
コード例 #2
0
        public void CreateHost(ApplicationServer server, WebSource webSource)
        {
            string v = vpath;

            if (v != "/" && v.EndsWith("/"))
            {
                v = v.Substring(0, v.Length - 1);
            }

            AppHost        = ApplicationHost.CreateApplicationHost(webSource.GetApplicationHostType(), v, realPath) as IApplicationHost;
            AppHost.Server = server;

            // Link the host in the application domain with a request broker in the main domain
            RequestBroker         = webSource.CreateRequestBroker();
            AppHost.RequestBroker = RequestBroker;
        }
コード例 #3
0
ファイル: VPathToHost.cs プロジェクト: akrisiun/Mono.XSP
        public void CreateHost(ApplicationServer server, WebSource webSource)
        {
            string v = vpath;

            if (v != "/" && v.EndsWith("/"))
            {
                v = v.Substring(0, v.Length - 1);
            }

            var domain      = AppDomain.CurrentDomain;
            var debugDomain = domain.GetData("DebugDomain") as DebugDomain;
            var listAsm     = domain.GetAssemblies();
            // { Mono.WebServer, Version = 4.4.0.0, Culture = neutral, PublicKeyToken = 0738eb9f132ed756}
            // { Mono.WebServer.XSP, Version = 4.9.0.0, Culture = neutral, PublicKeyToken = 0738eb9f132ed756}

            Exception error = null;

            try
            {
                var hostType = webSource.GetApplicationHostType();
                AppHost =
                    Mono.Web.Hosting.
                    ApplicationHost.CreateApplicationHost(hostType, v, realPath) as IApplicationHost;
                AppHost.Server = server;
            } catch (Exception err) { error = err.InnerException ?? err; }

            if (AppHost == null && error != null)
            {
                Console.WriteLine(error.Message);
                if (Debugger.IsAttached)
                {
                    Debugger.Break();
                }

                Console.ReadKey();
                // throw error;
            }

            if (!server.SingleApplication)
            {
                // Link the host in the application domain with a request broker in the main domain
                RequestBroker         = webSource.CreateRequestBroker();
                AppHost.RequestBroker = RequestBroker;
            }
        }
コード例 #4
0
ファイル: VPathToHost.cs プロジェクト: vietnt/xsp
        public void CreateHost(ApplicationServer server, WebSource webSource)
        {
            string v = vpath;
            if (v != "/" && v.EndsWith ("/")) {
                v = v.Substring (0, v.Length - 1);
            }

            AppHost = ApplicationHost.CreateApplicationHost (webSource.GetApplicationHostType(), v, realPath) as IApplicationHost;
            AppHost.Server = server;

            if (!server.SingleApplication) {
                // Link the host in the application domain with a request broker in the main domain
                RequestBroker = webSource.CreateRequestBroker ();
                AppHost.RequestBroker = RequestBroker;
            }
        }