Home > Net >  Webapi HttpClient send a POST request, external interface interface short calculation time can retur
Webapi HttpClient send a POST request, external interface interface short calculation time can retur

Time:11-22

Using (var httpClient=new httpClient ())
{
HttpClient. Timeout=new TimeSpan (24, 0, 0);//set the timeout

Var url=new Uri (" http://localhost:18081/model/cal ");

Var response=httpClient. PostAsJsonAsync (url, InputModel). The Result;//jars interface if the computation time is long, there is no return, stuck in this???
Var data=(https://bbs.csdn.net/topics/response.Content.ReadAsStringAsync). The Result;
}
========
Var response=httpClient. PostAsJsonAsync (url, dispatchInput). The Result
Send a POST request, external interface interface short calculation time can return, long calculation has not been returned, the same synchronous and asynchronous
External interface is jars, figured out the console is output, but the httpClient. PostAsJsonAsync (url, dispatchInput). The Result has been not return,
Interface short calculation time, can return, what happened?
Thank you very much!

CodePudding user response:

The timeout?

CodePudding user response:

reference 1 floor plans for melody reply:
timeout?
already set the timeout oh, timeout for 24 hours, if the jar package interface computation time more than 10 minutes, the jar with the output, but httpClient PostAsJsonAsync (), there is no return

CodePudding user response:

Look... ah, more bizarre,
External interface short calculation time can be, has been long card master in PostAsJsonAsync ()

CodePudding user response:

Meets the eye! Bosses such as learning how to answer

CodePudding user response:

https://blog.csdn.net/u011191463/article/details/78664896? Utm_medium=distribute. Pc_relevant. None - task - blog - BlogCommendFromMachineLearnPai2-1. Nonecase& Depth_1 - utm_source=distribute. Pc_relevant. None - task - blog - BlogCommendFromMachineLearnPai2-1. Nonecase

CodePudding user response:

refer to 6th floor mozi zichen response:
https://blog.csdn.net/u011191463/article/details/78664896? Utm_medium=distribute. Pc_relevant. None - task - blog - BlogCommendFromMachineLearnPai2-1. Nonecase& Depth_1 - utm_source=distribute. Pc_relevant. None - task - blog - BlogCommendFromMachineLearnPai2-1. Nonecase
this is a Java, c # seems to be only a TimeOut can be set,

CodePudding user response:

With postman first test interface isn't good, interface no problem to judge whether their program

CodePudding user response:

the jar with output
The output of the jars is what

CodePudding user response:

You approach this strange ah, web interface is not suitable for such a long time to call it, the timeout is useless for a webclient asynchronous, ah, can be accessed via the interface timing to have the results showed that no results will give up, waiting for another visit, why such a long time,

CodePudding user response:

External interface is within the company? So, ask them to complete the calculation after the initiative you push data interface, who have to wait so long ah, also don't have any time rule,

CodePudding user response:

refer to the eighth floor aquayhy response:
with postman first test the interface is good, the interface is no problem to determine whether their application problems

Postman interface test is good, is the jar package interface calculation to 20 minutes, the timeout is set to 30 minutes, calculate out CARDS in httpClient. PostAsJsonAsync ()

CodePudding user response:

11 references ying1234 response:
you practice this strange ah, web interface is not suitable for such a long time to call it, the timeout is useless for a webclient asynchronous, ah, can be accessed via the interface timing to have the results showed that no results will give up, waiting for another visit, why such a long time, created

External interface to calculate to more than 20 minutes, I set up 24 hours is long, set up 30 minutes, now is: 20 minutes to calculate the finished card httpClient. PostAsJsonAsync (),
This is the need to wait that long time, the front is the need to wait for oh

CodePudding user response:

I sent you a wrong what I won't
  • Related