My Notes from ASP.NET Community Standup - Mar 20, 2018 - ASP.NET Core 2.1 Updates for IIS Hosting

Authored by

This is the next in a series of blog posts that will cover the topics discussed in the ASP.NET Community Standup. The community standup is a short video-based discussion with some of the leaders of the ASP.NET development teams covering the accomplishments of the team on the new ASP.NET Core framework over the previous week. Within 30 minutes, Scott Hanselman, Damian Edwards, Jon Galloway and an occasional guest or two discuss new features and ask for feedback on important decisions being made by the ASP.NET development teams.

Each week the standup is hosted live on Google Hangouts and the team publishes the recorded video of their discussion to YouTube for later reference. The guys answer your questions LIVE and unfiltered. This is your chance to ask about the why and what of ASP.NET! Join them each Tuesday on live.asp.net where the meeting’s schedule is posted and hosted.

Sourabh Shirhatti talked about the improvements of IIS hosting for ASP.NET Core 2.1.

How do we try this?

Here's the blog post from a little while ago.

Call to action: Deploy to Azure

Alternatively, VS 2017 15.7-preview2 adds support for in-proc and will be out in a couple of days.

If we save our choice InProcess from the Debug tab of our project properties, the line number 18 will be generated automatically in our launchSettings.json file.

{  
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:18160",
      "sslPort": 44304
    }
  },
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_HTTPS_PORT": "44304",
        "ASPNETCORE_ENVIRONMENT": "Development"
      },
      "ancmHostingModel": "InProcess"
    },
    "WebApplication7": {
      "commandName": "Project",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_URLS": "https://localhost:44304;http://localhost:18160",
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }
  }
}

Motivations for doing this:

1. Performance

In their testing, Microsoft ASP.NET Core Team are seeing throughput improvements of between 4~6x.
They haven't yet measured latency.

2. Version Agility

Allows ASP.NET Core Team to ship ANCM at a faster cadence and allows them version with the rest of the stack.

Architectural changes

  • Instead of an IIS module that's a global singleton, we now ship in two separate dlls.
  • The shim(aspnetcore.dll) still ships globally and is installed via the ServerHostingBundle
  • The requestHandler(aspnetcorerh.dll) ships as a NuGet package. It can be consumed like any other NuGet package in our stack. (It will be available as part of the shared runtime, so by default you won't see it in your bin folder)

Show Experience in VS

ii C:\Users\toto\source\repos\StandupDemo\StandupDemo.sln  

Open project page and show switching between in-process and out-of-process

Show the /processName route to show what hosting model you have

Publishing

Show how adding this property to your .csproj changes the published web.config

  <PropertyGroup>
    <AspNetCoreModuleHostingModel>inprocess</AspNetCoreModuleHostingModel>
  </PropertyGroup>

(Unscientific) Perf test using Netling

Launch Netling

D:\Netling\Netling.Client\bin\x64\Debug\Netling.Client.exe  

This week’s meeting is below:

Community Links for the week

Jon shared 8 links for this week.

Exploring the Microsoft.AspNetCore.App shared framework in ASP.NET Core 2.1 (preview 1) ASP.NET Core 2.1 brings a surprising number of fundamental changes under the hood for a minor release, and fundamentally re-architects the way ASP.NET Core apps are delivered. However as a developer you don't have much to worry about. Other than switching to the Microsoft.AspNetCore.App metapackage and making some minor adjustments, the upgrade from 2.0 to 2.1 should be very smooth.

Using Message Pack with ASP.NET Core SignalR | Software Engineering This post shows how SignalR could be used to send messages between different C# console clients using Message Pack as the protocol. An ASP.NET Core web application is used to host the SignalR Hub.

Adam Storr - ASP.NET Core WebHooks - Running The Github Webhook Locally In this post Adam Storr has setup ngrok to tunnel external requests into his IISExpress development environment, setup a Github Webhook with a secret key and allowed you to debug through the filters.

Déjà vu by halter73 · Pull Request #2392 · aspnet/KestrelHttpServer Managed sockets will replace libuv as Kestrel's default transport for ASP.NET Core 2.1.

ASP.NET Core Dependency Injection - How to Register Generic Types - Steve Gordon

semantic-ui-aspnetcore-razor/_Layout.cshtml at master · bradygmsft/semantic-ui-aspnetcore-razor semantic-ui is similar to Bootstrap.

Create a build pipeline for Angular and ASP.NET Core apps with Visual Studio Team Services In this blog post, Fabian Gosebrink wants to describe how you can build up a build and release pipeline for your Angular and ASP.NET Core applications using Visual Studio Team Services.

Migrating to ASP.NET Core Tag Helpers This article introduces the concept of Tag Helpers in ASP.NET Core and how to use them effectively when migrating an ASP.NET project.

Q&A

Question: So it's Kestrel inside IIS?

— NO. It's NOT Kestrel. IIS is the server. It's a new IServer implementation. See https://github.com/aspnet/IISIntegration/blob/c833e7b9948960931b121cfeb8f89849432a1215/src/Microsoft.AspNetCore.Server.IISIntegration/Server/IISHttpServer.cs

Question: Benefits besides perf?

— Access to IIS features: HTTP/2 support, access to IIS Server variables, and whatever IIS does in the future.

Question: What's the catch?

— No support for Full Framework. Thus far, only CoreCLR is supported. Only 1 application per AppPool.

Question: Does the in-proc model improve on the port exhaustion scenario that could sometimes happen with the out-of-proc model?

— Yes, it does.

Question: Any plans to support an in-proc model for non-windows platform? e.g. like NGINX or Apache module that spins up an in-proc CoreCLR.

— No plan for the moment.

Question: How will the in-proc work in Azure WebApps?

— They should not be specific. When we publish, the configuration will be in the web.config.

Authored by

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.