老熟女激烈的高潮_日韩一级黄色录像_亚洲1区2区3区视频_精品少妇一区二区三区在线播放_国产欧美日产久久_午夜福利精品导航凹凸

重慶分公司,新征程啟航

為企業提供網站建設、域名注冊、服務器等服務

ASP.NET一個簡易的WebServer,用控制臺程序模擬IIS托起web服務

ASP.NET一個簡易的WebServer,用控制臺程序模擬IIS 托起web服務

網站的建設成都創新互聯專注網站定制,經驗豐富,不做模板,主營網站定制開發.小程序定制開發,H5頁面制作!給你煥然一新的設計體驗!已為成都門窗定制等企業提供專業服務。

     Proce***equestHandler( page,  query, TextWriter writer);      WebServer : MarshalByRefObject, IRegisteredObject
    {          Proce***equest( page,  query, TextWriter writer)
        {
            SimpleWorkerRequest worker =  SimpleWorkerRequest(page, query, writer);

            HttpRuntime.Proce***equest(worker);
        }          Stop( immediate)
        {
            HostingEnvironment.UnregisterObject();
        }
    }      SimpleHttpListener
    {
        Proce***equestHandler Proce***equest;          SetProce***equest(Proce***equestHandler handler)
        {            .Proce***equest = handler;
        }          PhysicRoot = .Empty;
         public void Run()
        {
            if (!HttpListener.IsSupported)
                throw new InvalidOperationException("使用 HttpListener 必須為 Windows XP SP2 或 Server 2003 以上系統!");
            string[] prefixes = new string[] { "http://localhost:49152/" };
            HttpListener listener = new HttpListener();
            foreach (string item in prefixes)
            {
                listener.Prefixes.Add(item);
            }
            listener.Start();
            Console.WriteLine("開始監聽.....");
            while (true)
            {
                HttpListenerContext context = listener.GetContext();
                HttpListenerRequest request = context.Request;
                Console.WriteLine("{0} {1} HTTP/1.1", request.HttpMethod, request.RawUrl);
                HttpListenerResponse response = context.Response;
                using (StreamWriter writer = new StreamWriter(response.OutputStream))
                {
                    StringWriter sw = new StringWriter();
                    string content = string.Empty;
                    string filename = request.Url.LocalPath.ToLower();
                    Regex reg = new Regex("(.aspx|.ashx|.svc|.asmx)");
                    Match m = reg.Match(filename);
                    if (m.Success)
                    {
                        string path = request.Url.AbsolutePath;
                        string query = request.Url.Query.Replace("?", string.Empty);
                        string prefx = m.Groups[0].Value;
                        if (!filename.EndsWith(prefx))
                        {
                            int index = path.IndexOf(prefx);
                            index = index + prefx.Length;
                            query = path.Substring(index);
                            path = path.Substring(0, index);

                        }
                        path = Path.GetFileName(path);
                        this.Proce***equest(path, query, sw);
                        content = sw.ToString();
                        sw.Close();

                        response.ContentLength74 = Encoding.UTF8.GetByteCount(content);
                        response.ContentType = "text/html; charset=UTF-8";
                        writer.Write(content);
                    }

                    else
                    {
                        string filePath = Path.Combine(PhysicRoot, request.Url.AbsolutePath.Substring(1));
                        lock (this)
                        {
                            byte[] buffer = new byte[4096];
                            if (File.Exists(filePath))
                            {
                                using (StreamReader sr = new StreamReader(filePath))
                                {
                                    response.ContentLength74 = sr.BaseStream.Length;
                                    int readLength = sr.BaseStream.Read(buffer, 0, buffer.Length);
                                    while (readLength > 0)
                                    {
                                        writer.BaseStream.Write(buffer, 0, readLength);
                                        readLength = sr.BaseStream.Read(buffer, 0, buffer.Length);
                                    }
                                }
                            }
                            else
                            {
                                string msg = "not found:" + filePath;
                                byte[] data = Encoding.UTF8.GetBytes(msg);
                                writer.BaseStream.Write(data, 0, data.Length);
                            }
                        }

                    }
                    Console.WriteLine("\r\nProcess Ok.\r\n");
                }
                if (Console.KeyAvailable)
                    break;
            }
            listener.Stop();

        }           Start()
        {
            PhysicRoot = ;
            WebServer server = CreateWorkerAppDomainWithHost((WebServer), , PhysicRoot)  WebServer;            
            SimpleHttpListener listener =  SimpleHttpListener();
            listener.SetProce***equest(server.Proce***equest);
            listener.Run();
        }          CreateWorkerAppDomainWithHost(Type hostType,  virtualPath,  physicalPath)
        {             uniqueAppString = .Concat(virtualPath, physicalPath).ToLowerInvariant();             appid = (uniqueAppString.GetHashCode()).ToString(, CultureInfo.InvariantCulture);             appmanager = ApplicationManager.GetApplicationManager();             buildManagerHostType = (HttpRuntime).Assembly.GetType();             buildManagerHost = appmanager.CreateObject(appid, buildManagerHostType, virtualPath, physicalPath, );
            buildManagerHostType.InvokeMember(, BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.NonPublic, , buildManagerHost,  [] { hostType.Assembly.FullName, hostType.Assembly.Location });             appmanager.CreateObject(appid, hostType, virtualPath, physicalPath, );
        }
    }

ASP.NET一個簡易的WebServer,用控制臺程序模擬IIS 托起web服務


當前標題:ASP.NET一個簡易的WebServer,用控制臺程序模擬IIS托起web服務
當前鏈接:http://www.xueling.net.cn/article/gsosih.html

其他資訊

在線咨詢
服務熱線
服務熱線:028-86922220
TOP
主站蜘蛛池模板: 东北少妇不带套对白 | 国产v亚洲v日韩v欧美v片 | av在线播放一区 | 亚洲av狼在线 | 2023国产一二三区日本精品2022 | 国产欧美久久久久 | 性久久久久 | 乱人伦中文无码视频在线观看 | 成人av影片在线观看 | 日本一区二区久久久 | 交换娇妻呻吟hd中文字幕 | 超碰人人人人人人 | 美女裸身裸乳视频网站 | 中文字幕二十三页2 | 五十六十日本老熟妇乱 | 久久99精品久久久久久久清纯 | 337P日本欧洲亚洲大胆在线 | 一区二区三区免费在线播放 | 最新中文字幕av无码专区不卡 | 国产三级精品片 | 成人宗合| 中文字幕乱码在线播放 | 宅男在线免费视频 | 国产黄片软件在线观看 | 成人影院视频 | 日本久久片 | 欧美日韩日本国产 | 国产美女视频黄a片免费观看软件 | 亚洲国产欧美国产综合久久 | 有码中文AV无码中文AV | 色哟哟国产精品免费观看 | 91福利视频在线观看 | 日日噜噜夜夜狠狠久久无码区 | 99久久夜色精品国产亚洲狼 | 欧美狠狠操| 中文字幕无码免费久久91 | 精品一区二区三区影院在线午夜 | 久久蜜桃精品 | 欧美日韩中文视频 | 日本在线免费 | 亚洲va |