我有一个托管在 IIS 10(Windows 服务器 2016)上的 asp.net web api。当我GET
从 Microsoft Edge 浏览器发出请求时,我看到它HTTP 2.0
在 IIS 日志中使用
2015-09-20 21:57:59 100.76.48.17 GET /RestController/Native - 443 - 73.181.195.76 HTTP/2.0 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/42.0.2311.135+Safari/537.36+Edge/12.10240 - 200 0 0 7299
但是,当GET
通过如下.net 4.6 客户端发出请求时,
using (var client = new HttpClient())
{
client.BaseAddress = new Uri("https://myapp.cloudapp.net/");
HttpResponseMessage response = await client.GetAsync("RestController/Native");
if (response.IsSuccessStatusCode)
{
await response.Content.CopyToAsync(new MemoryStream(buffer));
}
}
我在服务器日志中看到以下HTTP 1.1
日志
2015-09-20 20:57:41 100.76.48.17 GET /RestController/Native - 443 - 131.107.160.196 HTTP/1.1 - - 200 0 0 707
如何让 .net 客户端使用 HTTP/2.0 ?