AspNetCoreHostingModel inprocess vs outofprocess

right now i can only get things working using outofprocess

is this the appropriate thing to be using, or should i be using the default of inprocess? if inprocess, what needs to be adjusted so this works?

public static void Main(string args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseModularStartup()
.UseUrls(Environment.GetEnvironmentVariable(“ASPNETCORE_URLS”) ?? “http://localhost:5000”)
.Build();

        host.Run();
    }

The ASP.NET Core hosting models are explained in ASP.NET Core docs whilst the Web server implementations docs goes through the different web server implementations in ASP.NET Core.

These docs go through how to configure ASP.NET Core App to use IIS InProcess.

i already found that, and it does not work as simply as it implies.

if i use this:

x new selfhost someproject

and then add the UseIISIntegration call as above, when i publish in VS2019, I get a web.config that looks like:

<?xml version="1.0" encoding="utf-8"?> in IIS i have my site set up to listen on port 5000

this results in a socket binding error, so if i change SS project to do this:

.UseUrls(Environment.GetEnvironmentVariable(“ASPNETCORE_URLS”) ?? “(http://localhost:5001/)”)

Then you end up with this:

HTTP Error 500.37 - ANCM Failed to Start Within Startup Time Limit
Common solutions to this issue:
ANCM failed to start after 120000 milliseconds

how do you tell IIS to talk to localhost on 5001 while serving itself on 5000?

if you look at the IIS section of the docs i has all this stuff:

https://docs.servicestack.net/iis

is this needed with IIS on 2019 and .net core 3.1?

So i guess what i want to know is:

  1. What SS project to use for API only (web., selfhost?)
  2. What additional config needs to be done to the project to get it to work with IIS
  3. What settings for IIS website? set physical path and a binding on a port?
  4. What does web.config need to look like
  5. do i need this? https://www.iis.net/downloads/microsoft/application-request-routing

it sure looks like thing have changed between 2.2 and 3.1, because InProcess is now the default in a .net core project.

i am sure i would probably not even come close to the limits when it comes to outofprocess, but thats not the point. i just cannot find documentation that shows how to make this work and i spent hours last night trying different things to get the default project and default IIS site stuff working

why cant there be a simple Hello app example that works for your recommended approach when using IIS (in or out process)?

should it be using WebHostBuilder() or CreateDefaultBuilder()?

The CreateDefaultBuilder() for initializing the generic host is the current recommendation for .NET Core 3.1. The empty recommend starting from template is web, whilst the selfhost is for the minimal starting configuration for Kestrel SelfHost.

When you use IIS inprocess, you’re not using Kestrel or running your .NET Core App on a different port, i.e. the IIS Web Server is running your .NET Core App “In process”.

ServiceStack is the same as any other .NET Core 3.x App, the official Microsoft docs for configuring the IIS ASP.NET Core Module for your .NET Core App starts from:

Whilst these docs go through setting up IIS and publishing your App to IIS:

OK thanks a lot. getting my head around this now.

the web template seems to be working fine with inprocess.

thanks again

1 Like