Posted by Anuraj on Saturday, August 25, 2018 Reading time :1 minute
This post is about enabling HTTP2 on Kestrel. HTTP/2 is a major revision of the HTTP protocol. Some of the notable features of HTTP/2 are support for header compression and fully multiplexed streams over the same connection. While HTTP/2 preserves HTTP’s semantics (HTTP headers, methods, etc.) it is a breaking change from HTTP/1.x on how this data is framed and sent over the wire.
First you need a SSL certificate, you can use the ASP.NET Development certificate. Open Microsoft Management console > Click on File menu and Select Add/Remove Snap in. Select
Certificates from available snap-ins, click on
Add. And select
My User Account, and click on Finish. Click OK. This will list all the certificates under current user account.
You need the certificate to be exported as PFX file. You can right click on the certificate and choose Export option from All Tasks menu, then continue with Export with private key option, then provide the password. Click on next and choose the location to save the PFX file. You can save it in the project file location.
Here is the code, which required to enable HTTP2. You need to add the following code in the
This is for development, if you want to deploy to live, you need to change the
You can verify it with chrome developer tools.
You will be able to see
h2 on the protocol column.
This way you will be able to enable HTTP2 protocol on ASP.NET Core Kestrel. But in the current version of Kestrel, HTTP2 features like Server Push, Stream Prioritization, HTTP Trailers etc. is not implemented.
Happy Programming :)
What do you think? I would like to hear your thoughts, suggestions, and questions in the comments section below.