简体   繁体   English

使用带有 flurl 的 HTTP/2

[英]Use HTTP/2 with flurl

Is it possible to send a get/post..etc request using http 2 with flurl?是否可以使用带有 flurl 的 http 2 发送 get/post..etc 请求? If not, is there a way to do it?如果没有,有没有办法做到这一点?

I have tried using Use HTTP 2 with HttpClient in .Net , but I always get WinHttpException: Error 12156 calling WINHTTP_CALLBACK_STATUS_REQUEST_ERROR, 'The HTTP redirect request failed'.我曾尝试在 .Net 中使用Use HTTP 2 with HttpClient ,但我总是得到WinHttpException: Error 12156 calling WINHTTP_CALLBACK_STATUS_REQUEST_ERROR, 'The HTTP redirect request failed'.

You should disable auto redirects to get it to work.您应该禁用自动重定向以使其正常工作。 The problem is most likely with the server doing something non-standard/wrong.问题很可能是服务器做了一些非标准/错误的事情。

Just set the AllowAutoRedirect property to false for the HttpClientHandler of your HttpClient .只需将HttpClientHandlerHttpClientAllowAutoRedirect属性设置为 false 。

new HttpClient(new HttpClientHandler { AllowAutoRedirect = false });

However, you should still see what the redirect response really is and probably handle it manually by making another request.但是,您仍然应该看到重定向响应的真正含义,并且可能会通过发出另一个请求来手动处理它。 It's hard to say without knowing the URL and what it really tries to return to you.如果不知道 URL 以及它真正试图返回给您的内容,就很难说。

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

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