Beta8 and the new hosting model

In ASP.NET6 beta8, Helios (IIS native host) has been removed. Instead you can use Kestrel host and configure IIS server to talk to the host. This hosting model should be very familiar with people using ASP.NET 6 on Linux as they may have already been using this hosting model from previous betas. I won’t write much about the hosting model as Damian Edwards already has a detailed post on that here: https://github.com/aspnet/Announcements/issues/69
However, I will describe some change that everyone that are using Helios on Windows would have to make to their beta7 projects.

Basically the upgrade steps to beta8 involve:
1. Install HttpPlatformHandler 1.2, DNX beta8 and the latest web tooling
2. Remove

and add (if you don’t have it yet)

and change the web command to use the new host

3. Update all packages and global.json to beta8 and fix all breaking changes
4. Remove the bin folder in wwwroot (you may need to manually remove that folder in your Azure Web App as well)
5. Add a web.config file inside wwwroot with this content:

If you have already installed the new VS web tooling and run the project with IIS Express, a slightly different web.config will be added automatically, which runs fine on the local machine but may cause problem on Azure Web App. So please make sure that the element httpPlatform is correct.
6. Add

into Startup.cs so that headers, scheme and other stuffs can be redirected properly from IIS to Kestrel. For example, your HTTPS request will be seen as HTTP without this line. However, I am still not very sure about the correct place for this line; the default template seems to put it after error handling, while I think it should the first middleware to be registered.

If you have issues, the discussion thread in GitHub is very useful: https://github.com/aspnet/Hosting/issues/364.
Besides, please feel free to comment if you see anything incorrect in the post. And I will also update the post with more issues/solution as I encounter them.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.