简体   繁体   English

C#httpclient超时问题

[英]Timeout issues with C# httpclient

My problem is with uploading big files with httpclient postasync method. 我的问题是使用httpclient postasync方法上传大文件。 It times out and so on. 它超时等等。 I did find this great blog post about httpwebrequest ( http://www.thomaslevesque.com/2014/01/14/tackling-timeout-issues-when-uploading-large-files-with-httpwebrequest/ ) which tells how to deal with timeout issues when using httpwebrequest. 我确实找到了这篇关于httpwebrequest( http://www.thomaslevesque.com/2014/01/14/tackling-timeout-issues-when-uploading-large-files-with-httpwebrequest/ )的博文,讲述了如何处理使用httpwebrequest时出现超时问题。 However the current request is done with httpclient so I'm wondering if there is any way to do it with httpclient? 但是当前请求是用httpclient完成的,所以我想知道是否有任何方法可以用httpclient做到这一点?

In the other posts there are ideas to split the chunk of data. 在其他帖子中,有一些想法可以分割数据块。 However I don't see any reason to do extra work if the timeout can be disabled for transfer part of the request. 但是,如果可以为请求的传输部分禁用超时,我认为没有任何理由进行额外的工作。

Apparently there is no way to do this with httpclient. 显然,使用httpclient无法做到这一点。 Httpclient uses httpwebrequest so the only way to do this is by using httpwebrequest. Httpclient使用httpwebrequest,所以唯一的方法是使用httpwebrequest。 Which seems to be working well like in the Thomas's blog. 这似乎在托马斯的博客中运作良好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM