Creating HTTP/2 Supported Website With ASP.NET Core and Hosting In Windows 10 (IIS 10.0.x)

aspnet

ASP.NET Core

ASP.NET Core is an open source and cross-platform technology by Microsoft for developing web-based applications. In .NET Framework 4.6.0 Microsoft announced support for HTTP/2. So the .NET Framework 4.6.0 & 4.6.1 supports HTTP/2.

HTTP/2

HTTP/2 is a new version of HTTP protocol, faster than http 1.1. HTTP/2 is binary instead of textual, fully multiplexed instead of blocking, and allows the server to “push” responses proactively into client caches. It also provides the feature of parallelism and header compression which improves website performance drastically.

As per caniuse.com HTTP/2 is supported by the following browsers,

browsers

There are many server softwares which support HTTP2, such as Microsoft IIS in Windows 10 & Windows Server 2016, Apache 2.4.12, Wildfly 9, Citrix NetScaler 11.x, Sucuri, h2o, Jetty 9.3, Proxygen, etc.

Create ASP.NET Core 1.0 Web Application

Now create an ASP.NET Core 1.0 web application which will support HTTP/2 in Windows 10.

Open Visual Studio 2015

Click File, then New Project

new

Select .NET Framework 4.6, provide name of the web application and click on OK.

web app

Inside ASP.NET 5 Templates select Web Application Template – Click OK.

Now you can see that a web application has been created. I am not going to add anything I will just run the application. If you want to add anything you can do it but my intention is to show HTTP/2 support.

Run the application in Microsoft edge browser.

Press F12 inside Microsoft edge browser—Go to Network Tab,

tab

You can see that it is still using HTTP not HTTP/2.

So we need to configure IIS so that it can use HTTP/2.

Configure IIS to support HTTP/2

On Run command type “inetmgr ui”.

run

It will open IIS UI. Click on Logging.

logging

Click on Select Fields…

field

Go to W3C Logging Fields and select Protocol Version (cs-version),

w3c

w3c

Click on OK.

Click on apply in Logging window.

window

Make sure that the  required option has been enabled in IIS.

Go to control panel, program and features, and then turn Windows features on or off,

features

Then go to Server Certificates inside IIS (open from Run- inetmgr),

server

Inside the Server Certificates window click on “Create Self-Signed Certificate…

server

You can give any name for this certificate. There is no hard and fast rule for that. I have just given my name in the certificate name. You can give any name.

name

Now Edit the bindings of your website. Select the default website and click on Bindings,

binding

It will open Site Binding window and click on add,

add

Click Ok. Finally IIS has been configured to support HTTP/2.

But still my ASP.NET Core needs one more change to support HTTP/2. So, now I will enable SSL for my ASP.NET Core application.

Enabling SSL for ASP.NET Core Application

Now go to your Visual Studio – select your project from solution explorer window (The ASP.NET Core project which you have created to support HTTP/2. Right click on it and select properties, go to debug tab, and then enable SSL

ssl

Save and close.

HTTP/2 Support in Microsoft Edge

Now press F5 to run the application and make sure that IIS Express is selected.

Enter the https URL of the project in browser.

browser

Now you can see that you have successfully created an application which supports HTTP/2.

I am using Microsoft Edge for HTTP/2 but after configuring IIS to support HTTP/2 any browser which is supporting HTTP/2 will support HTTP/2 support for my ASP.NET Core application.

HTTP/2 Support in Internet Explorer11

explorer

In the same way, you can check it for Google chrome, Mozilla Firefox or any other HTTP/2 supported browsers.

To see the list of HTTP/2 supported browsers refer to the screenshot which I have used in the beginning of this article.

Finally, we have created an ASP.NET Core (ASP.NET 5) web application which can support HTTP/2 in Windows 10 by hosting it on IIS 10.0.x.

Read more articles on ASP.NET Core:

Up Next
    Ebook Download
    View all
    Learn
    View all