Exemplo n.º 1
0
        public void ProcessRequest(HttpContext context)
        {
            DateTime reqBegin = DateTime.Now;

            context.Response.ContentType = "text/plain";

            string key     = context.Request["key"];
            int    rst_num = 10;

            rst_num = int.TryParse(context.Request["num"], out rst_num) ? rst_num : 10;

            int      sqls      = int.TryParse(context.Request["sqls"], out sqls) ? sqls : 0;
            int      sqlr      = int.TryParse(context.Request["sqlr"], out sqlr) ? sqlr : 0;
            bool     readClob  = bool.TryParse(context.Request["readc"], out readClob) ? readClob : false;
            bool     readBlob  = bool.TryParse(context.Request["readb"], out readBlob) ? readBlob : false;
            bool     writeClob = bool.TryParse(context.Request["writec"], out writeClob) ? writeClob : false;
            bool     writeBlob = bool.TryParse(context.Request["writeb"], out writeBlob) ? writeBlob : false;
            DateTime dbBegin   = DateTime.Now;

            if (sqls > 0)
            {
                DbEx.Insert(sqls, writeClob, writeBlob);
            }
            if (sqlr > 0)
            {
                DbEx.GetData(sqlr, readClob, readBlob);
            }
            DateTime dbEnd = DateTime.Now;

            JavaScriptSerializer jsSerializer = new JavaScriptSerializer();

            jsSerializer.MaxJsonLength = int.MaxValue;
            context.Response.Write(
                jsSerializer.Serialize(
                    new {
                AppBegin = reqBegin,
                DbBegin  = dbBegin, DbEnd = dbEnd, DbDuration = (Int64)((dbEnd - dbBegin).TotalMilliseconds),
                Nodes    = MakeData(key, rst_num),
                AppEnd   = DateTime.Now, AppDuration = (Int64)((DateTime.Now - reqBegin).TotalMilliseconds)
            }));
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";


            string key = context.Request.Form["content"];

            try
            {
                DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(PerfData));
                MemoryStream mStream = new MemoryStream(Encoding.UTF8.GetBytes(key));
                PerfData     data    = serializer.ReadObject(mStream) as PerfData;
                data.Id      = Guid.NewGuid().ToString();
                data.LogDate = DateTime.Now;

                DbEx.SavePerf(data);
            }
            catch (Exception ex)
            {
                ex.ToString();
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            context.Server.ScriptTimeout = 600;
            context.Response.Write("Hello 111");
            context.Response.Flush();

            //context.Response.Redirect("", false);
            //context.Response.End();
            //context.ApplicationInstance.CompleteRequest();
            //context.Server.Transfer("");
            //context.Server.Execute("");

            for (int i = 1; i <= 60; i++)
            {
                //context.Response.Write(string.Format("Hello tkk {0}", i));
                //context.Response.Flush();
                DbEx.Insert(1, false, false);

                System.Threading.Thread.Sleep(1000);
            }

            context.Response.Write("Hello World End");
        }