4

Recently I enabled HTTP/2 support on Azure for our Web API. Followed this guide:

https://learn.microsoft.com/en-us/iis/get-started/whats-new-in-iis-10/http2-on-iis

However when I try to do a HTTP/2 enabled request from our HttpClient I am getting following exception:

Only HTTP/1.0 and HTTP/1.1 version requests are currently supported. Parameter name: value

I have the latest System.Net.Http nuget package installed and setting the version on the request like this:

yourHttpRequestMessage.Version = new Version(2, 0);

I have no idea what is wrong here given that I followed the guide and used the latest System.Net.Http nuget package.

Note that the HttpClient is living in a .net standard library and is being used in a Xamarin application.

Jakub Holovsky
  • 6,543
  • 10
  • 54
  • 98
  • Is there any documentation stating that latest `System.Net.Http` supports 2.0 – Nkosi Jul 04 '18 at 16:16
  • Check remarks here https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=netframework-4.7.2#remarks it looks like it is support on some platforms. – Nkosi Jul 04 '18 at 16:18
  • For windows you would need to change the handler to use [WinHttpHandler Class](https://learn.microsoft.com/en-us/dotnet/api/system.net.http.winhttphandler?view=netcore-2.0&viewFallbackFrom=netframework-4.7.2) – Nkosi Jul 04 '18 at 16:20
  • 1
    This looks promising https://stackoverflow.com/a/43101990/5233410 – Nkosi Jul 04 '18 at 16:27

0 Answers0