[转帖] IIS 与 HTTP/2 的介绍.
HTTP/2 on IIS
https://blogs.iis.net/davidso/http2
In October, we announced that IIS in the Windows 10 Technical Preview added support for HTTP/2. Windows 10 is now available, and HTTP/2 support is present in Windows 10 and the Server 2016 Technical Preview. HTTP/2 is a major upgrade after nearly two decades of HTTP/1.1 use and reduces the impact of latency and connection load on web servers.
What is HTTP/2?
HTTP/2 is a rework of how HTTP semantics flow over TCP connections. The major advance of HTTP/1.1 was the use of persistent connections to service multiple requests in a row. In HTTP/2, a persistent connection can be used to service multiple simultaneous requests. In the process, HTTP/2 introduces several additional features that improve the efficiency of HTTP over the network.
One connection for multiple requests
Every TCP connection requires a round trip to set up. If you’re using encryption, the TLS handshake takes another 1-2 round trips. All this happens before the first byte of the first response can be sent. By reusing an existing connection instead of setting up a new one, this overhead can be shared by many requests. HTTP/2 sharply reduces the need for a request to wait while a new connection is established, or wait for an existing connection to become idle. Because a single connection is multiplexed between many requests, the request can usually be sent immediately without waiting for other requests to finish.
Header compression with HPACK
HTTP has supported compression of data for ages. Headers, however, are sent as uncompressed text, with a lot of redundancy between requests. (Many of the longest headers are sent with exactly the same value on every request!) HTTP/2 introduces HPACK, a compression scheme for HTTP headers which reduces the redundancy between requests.
Compression helps multiplexing, because requests are smaller. This enables clients to make many requests in their first packets on a connection, while TCP flow control windows are still small.
Server push
Requests come in patterns. If a client asks for one resource, the server can often predict that it will need other resources referenced on the page. In HTTP/1.1, inlining was used to deliver these resources to clients as part of the first response. Inlining has its drawbacks – most notably, that the inlined resource can’t be cached for use on other pages where it might also be referenced.
HTTP/2 introduces the concept of “push” – the server responding to requests the client hasn’t made yet, but it predicts the client will. This allows servers to continue providing the latency benefits of inlining, but in a form that the client can cache and reuse on other pages.
How do I use HTTP/2?
You might be already! Since Almost all browsers already support HTTP/2 in their most current release, and current data shows that over 50% of users are on HTTP/2-capable browsers already.
On the server, IIS running on Windows 10 or previews of Server 2016 supports HTTP/2.
IIS currently supports HTTP/2 only over TLS. When making an HTTPS connection to a web server running IIS on Windows 10, HTTP/2 is used if the client and server both support it. In IIS, we’ve implemented HTTP/2 as transparently as possible – you shouldn’t need to change anything in your application for HTTP/2 to work. Certain HTTP/1.1 optimizations (domain sharding, inlining, etc.) are no longer recommended in HTTP/2, though, so you should plan to remove these in the future.
What about push?
Since Server Push is a new feature in HTTP/2, there are new APIs that you need to call to take advantage of it. When you call the PushPromise API in ASP.NET or the HttpDeclarePush API from an IIS native module, you provide the URL and optional request headers for the request you anticipate the client making. If push is supported by the underlying connection, two things happen:
- A PUSH_PROMISE is sent to the client, so the client can check whether the resource already exists in the cache
- A new request is added to the request queue for the pushed resource
If the underlying connection doesn’t support push (client disabled push, or HTTP/1.1 client), the call does nothing and returns success, so you can safely call the API without needing to worry about whether push is allowed.
IIS Settings
There are no new IIS configuration settings specific to HTTP/2.
In a previous Windows Server 2016 Tech Preview blog post, there was a mention of setting a ‘DuoEnabled’ registry key. This is no longer required. As mentioned above, provided the client and server configuration supports HTTP/2, then IIS will use HTTP/2 (or fallback to HTTP/1.1 if not possible).
Logging Protocol Version
IIS Logging has a field ‘Protocol version’ which is off by default. Enabling this field is useful if you want to track which requests are going via HTTP/2, HTTP/1.1 etc.
In Inetmgr UI, this can be found under the Logging feature, through ‘Select Fields’.

After making the changes, click on ‘Apply’ under the Actions pane on the far right.
Sample Log file output with Protocol Version field enabled:
#Software: Microsoft Internet Information Services 10.0
#Version: 1.0
#Date: 2015-08-13 18:46:11
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs-version cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken
2015-08-13 18:46:11 ::1 GET / - 443 - ::1 HTTP/2.0 Mozilla/5.0+(Windows+NT+10.0;+WOW64;+Trident/7.0;+Touch;+rv:11.0)+like+Gecko - 200 0 0 391
2015-08-13 18:46:11 ::1 GET /iisstart.png - 443 - ::1 HTTP/2.0 Mozilla/5.0+(Windows+NT+10.0;+WOW64;+Trident/7.0;+Touch;+rv:11.0)+like+Gecko https://localhost/ 200 0 0 100
IIS with HTTP/2 Demo Walkthrough
- If you are running Windows 10, this can be found via ‘Programs and Features’, then ‘Turn Windows features on or off’, then enabling ‘Internet Information Services’ checkbox. If you are running Windows Server 2016 Tech Preview, then launch Server Manager, then ‘Add roles and features’ on the dashboard and select ‘Web Server (IIS)’ from the list.

- After installation is complete, launch inetmgr.exe and create a self signed certificate by selecting the ‘Server Certificates’ option under the server’s Features View. Note that the use of a self signed certificate in this example is only for demo/testing purpose (not recommended for protecting your production sites).

- Go to your Default Web Site and under Bindings, create a new TLS binding with the self signed certificate just created.

- Launch Edge browser (or IE) from your Windows 10 or Windows 2016 Tech Preview machine and hit F12 (or go to Settings and enable F12 Developer Tools) and switch to the Network tab. Browse to https://localhost and voila, you are on HTTP/2!

HTTP/2 Not Supported
In a few cases, HTTP/2 can’t be used in combination with other features. In these cases, Windows will fall back to HTTP/1.1 and continue the transaction. This may involve negotiating HTTP/1.1 during the handshake, or sending an error code to the client instructing it to retry over an HTTP/1.1 connection.
- Windows authentication (NTLM/Kerberos/Negotiate) is not supported with HTTP/2. In this case IIS will fall back to HTTP/1.1.
- Clear text – as mentioned above, IIS currently only supports HTTP/2 over TLS. Again, IIS will fall back to HTTP/1.1.
- Bandwidth throttling – IIS has a feature to limit bandwidth (in Inetmgr, select the site, ‘Limits’ under Configure of the Action pane). This applies to HTTP/1.1 but is not enforced for HTTP/2 (will proceed with no errors or bandwidth limiting).
For more information….
See the Build 2015 talk HTTP/2 in Windows 10: Browser, Apps, and Web Server for a more in-depth discussion of HTTP/2 and the client and server implementations in Windows.
Authors: Mike Bishop, David So
(With contributions from and acknowledgements to Rob Trace, Baris Caglar, Nazim Lala)
[转帖] IIS 与 HTTP/2 的介绍.的更多相关文章
- iis中MIME类型的介绍与使用
今天在服务器上碰到由.mp3格式转化生成的.m4r格式不能被浏览器访问(MP3与m4r在同个域名目录下eg:www.abc.com/1.m4r) 解决办法: 1.选中文件所在的站点: 2.找到MIME ...
- 【转帖】互联网加密及OpenSSL介绍和简单使用
转帖:https://mritd.me/2016/07/02/%E4%BA%92%E8%81%94%E7%BD%91%E5%8A%A0%E5%AF%86%E5%8F%8AOpenSSL%E4%BB%8 ...
- [转帖]Windows Server 2016各种版本介绍
Windows Server 2016各种版本介绍 http://www.5sharing.com/js/zx/872.html windows server的版本 时间:2018-10-06 10: ...
- [转帖]Nginx 的 TCP 负载均衡介绍
Nginx 的 TCP 负载均衡介绍 https://www.cnblogs.com/felixzh/ 前几天同事问 nginx的代理 当时以为只有http的 现在看起来还有tcp的可以使用tcp 代 ...
- [转帖]IIS内虚拟站点配置信息说明
web.config配置详细说明 https://www.cnblogs.com/zhangxiaolei521/p/5600607.html 原作者总结的很详细 但是没有完全的看完 自己对IIS 的 ...
- [转帖] IIS经典模式和集成模式的区别
在 IIS 7.0 中,应用程序池有两种运行模式:集成模式和经典模式. https://blog.csdn.net/hongwei_23/article/details/44300923 这里面添加一 ...
- [转帖]nvidia nvlink互联与nvswitch介绍
nvidia nvlink互联与nvswitch介绍 https://www.chiphell.com/thread-1851449-1-1.html 差不多在一个月前在年度gtc会议上,老黄公开了d ...
- [转帖]微服务框架Spring Cloud介绍 Part1: 使用事件和消息队列实现分布式事务
微服务框架Spring Cloud介绍 Part1: 使用事件和消息队列实现分布式事务 http://skaka.me/blog/2016/04/21/springcloud1/ APR 21ST, ...
- [转帖]UML类图新手入门级介绍
UML类图新手入门级介绍 2010-11-12 19:45:00 monkey_d_meng 阅读数 27230 收藏 文章标签: umlinterfaceclass编程扩展更多 分类专栏: 软件工 ...
随机推荐
- 【转载】MSXML应用总结 概念篇
原文:http://blog.sina.com.cn/s/blog_48f93b530100e9tr.html 微软提供了大量的XML开发工具和技术,而SMXML(Microsoft XML Core ...
- 牛客网NOIP赛前集训营-提高组(第六场)-A-最长路[拓扑排序+hash+倍增]
题意 给定一个 \(n\) 点 \(m\) 边的边权非负的有向图,边有字符,求以每个点为开头的最长路字典序最小的路径 \(hash\) 值. \(n,m\leq 10^6\) 分析 首先建反图拓扑排序 ...
- Nginx应用场景
1. Nginx应用场景 1)http服务器.Nginx可以独立的提供http服务,可以做网页静态服务器(也就是将静态文件放到nginx目录下,通过nginx来访问就ok) 2)虚拟主机,可以在一 ...
- hdu2544最短路(dijkstra)
传送门 dijkstra #include<bits/stdc++.h> using namespace std; const int INF=0x3f3f3f3f; ; int dist ...
- ubuntu18.04上的draftsight 2D的安装
1: 先安装draftsight 需要的支持库 sudo apt-get install libuuid1:i386 libice6:i386 libsm6:i386 libxt6:i386 liba ...
- 随机游走模型(RandomWalk Mobility)
随机游走模型由首先由爱因斯坦在1926年以数学方式描述.由于自然界中的许多实体会以不可预知的方式移动,因此随机游走模型用来描述这种不稳定的移动.在这种移动模型中,移动节点随机选择一个方向和速度来从当前 ...
- OpenGL 笔记<1> 固定管线实例 + 双缓存测试实例
欲以此分类来记录opengl的学习历程,此为第一篇,所以先来一个固定管线的例子,以及对双缓存的测试. 一.配置环境 写之前,先进行配置,然后再讲内容. 注:第一部分涉及的代码均忽略. [环境配置传送门 ...
- Netty源码分析第2章(NioEventLoop)---->第6节: 执行select操作
Netty源码分析第二章: NioEventLoop 第六节: 执行select操作 分析完了selector的创建和优化的过程, 这一小节分析select相关操作 跟到跟到select操作的入口 ...
- Streamr助你掌控自己的数据(3)——教你在Streamr市场上发布数据
博客说明 所有刊发内容均可转载但是需要注明出处. 教你在Streamr市场上发布数据 本系列文档主要介绍怎么通过Streamr管理自己的DATA,整个系列包括三篇教程文档,分别是:教你5分钟上传数据至 ...
- 初学node.js-nodejs安装运行(1)
1.Node.js中文官网http://nodejs.cn/download/下载node.js 学习node.js需要有javascript基础,没有基础的可以在http://www.w3schoo ...