webapi 或 mvc Reponse 返回数据后 仍然执行程序

        /// 
        /// 缓冲区 输出数据 输出后 仍然执行
        /// 
        [HttpPost]
        [HttpGet]
        public void test()
        {
            HttpResponse http = HttpContext.Current.Response;

            http.StatusCode = 200;

            http.Clear();

            http.ClearHeaders();

            http.Buffer = false;

            http.ContentType = "application/json";

            http.AddHeader("Content-Length", System.Text.Encoding.UTF8.GetBytes("我的我的我的我的我的我的我的我的我的我的我的").Length.ToString());

            http.Write("我的我的我的我的我的我的我的我的我的我的我的");

            http.Flush();

            http.End();

            Debug.Print(string.Format("[Execution of {0} - {1} took {2}.]", "test", "test", "11111"));

        }

 

你可能感兴趣的:(.net)