c# - Does HttpClient spin a new thread even if I immediately get the Result of the returned task? -


In my application, I am trying and will be consistent and use HTTP client whenever I can. However, sometimes I do not need the asynchronous properties of the HTTP client and so I'm just returning as a result of the actions shown in the code given below.

  Public HTTPRPSpage message httpPostWrapperMethod (string postbodie, string url) {HttpContent content = new string content (PostBody, encoding. UTF8, "App / JS"); HTTP Client Client = New HTTP Client (); Return Client.PostSync (URL, Content) result; }  

My two part question is:

What if this call can be applied to a new thread in the background?

And

If my calls for this second service are taking around 500 mms, then is it causing me to eat several threads when the service is around 100 requests / seconds Is under production load? No threads are being created as a result,

PostAsync In fact, the code was used to use asynchronously, for this purpose, no thread will ever be needed. In your case here you sit around the current thread nothing, when you wait for the operation to finish, then there is only one thread which is being spent / wasted during this operation. is.


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -