Async HttpWebRequest with no wait from within a web application

前端 未结 3 1172
暗喜
暗喜 2020-12-24 02:45

In my web application (ASP.NET) I have a block of code that uses HttpWebRequest to make a call to a REST service and continue execution. Right now it\'s taking longer than I

3条回答
  •  再見小時候
    2020-12-24 03:34

    HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(myUrl);
    //set up web request...
    ThreadPool.QueueUserWorkItem(o=>{ myRequest.GetResponse(); });
    

    Also known as Fire-and-Forget.

提交回复
热议问题