public void ProcessRequest(Connection conn) {
            // Add a pending call to make sure our thread doesn't get killed
            AddPendingCall();

            try {
                Request request = new Request(_server, this, conn);
                request.Process();
            }
            finally {
                RemovePendingCall();
            }
        }
示例#2
0
文件: Program.cs 项目: kxie/m2net
        static void Main(string[] args)
        {
            if (args.Length != 5)
            {
                Console.WriteLine("usage: m2net.AspNetHandler.exe senderId subAddr pudAddr physicalDir virtualDir");
                return;
            }

            string sender_id = args[0];
            string sub_addr = args[1];
            string pub_addr = args[2];
            string dir = args[3];
            string virt = args[4];

            if (!Directory.Exists(dir))
            {
                Console.WriteLine("Physical directory '{0}' does not exist.", dir);
                return;
            }

            Connection conn;
            try
            {
                conn = new Connection(sender_id, sub_addr, pub_addr);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Could not create Mongrel2 connection: " + ex.Message);
                return;
            }

            Server srv;
            try
            {
                srv = new Server(conn, virt, dir);
            }
            catch(Exception ex)
            {
                Console.WriteLine("Could not create ASP.NET server: " + ex.Message);
                return;
            }

            srv.Start();

            Console.WriteLine("Press enter to exit m2net.AspNetHandler.");
            Console.ReadLine();

            srv.Stop();
        }
示例#3
0
 public Request(Host host, Connection conn)
     : base(string.Empty, string.Empty, null)
 {
     this._host = host;
     this._conn = conn;
 }