How to host multiple .NET Core apps under same url

You could use a reverse proxy for serving multiple ASP Net Core application on the same domain.
Using IIS I'm not quite sure but you need to install URL Rewrite and then follow the documentation provided by Microsoft (also this one should be helpful).
You can also use nginx using location and proxy_pass as follow:

...
Some nginx Configuration 
location /App1 {
        proxy_pass http://127.0.0.1:443;
    }
location /App2 {
        proxy_pass http://127.0.0.1:444;
    }
location /App3 {
        proxy_pass http://127.0.0.1:445;
    }
Other configurations...

And then, each time you want add another ASP Net application to your domain you'll need to add another location, run the application on a different point and restart nginx.


I got this working using the advice for Sub-applications here: https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-2.2#sub-applications.

Here's the meaty part, in case the link dies:

To host an ASP.NET Core app as a sub-app under another ASP.NET Core app:

1.Establish an app pool for the sub-app. Set the .NET CLR Version to No Managed Code because the Core Common Language Runtime (CoreCLR) for .NET Core is booted to host the app in the worker process, not the desktop CLR (.NET CLR).

2.Add the root site in IIS Manager with the sub-app in a folder under the root site.

3.Right-click the sub-app folder in IIS Manager and select Convert to Application.

4.In the Add Application dialog, use the Select button for the Application Pool to assign the app pool that you created for the sub-app. Select OK.

As a bonus, my main application is legacy Web Forms and my sub-application is exciting new .NET Core functionality.

Happy days.


You don't need to create a site for each app, you can host it as before, as web applications inside one site. The only thing you need to do is select unmanaged app pool for your .Net Core applications, that's it. So this works: https://domain/app1 and https://domain/app2 and you only need 1 certificate for a web server

Alternatively, you can create site for each app, then you need a sub-domain for each app, like https://app1.domain and like https://app2.domain In this case all sub-domains must point to the same IP (if your server only have one) and you need to set up bindings for each site\app to it's domain. You should bind all sites to the same port (443 or 80).

For SSL in multiple sites configuration if you have IIS 7 you need to have a wildcard certificate. In IIS 8 and above you can use Server name indication feature and have a separate certificate for each site, however I recommend you to use wildcard certificate as well since SNI is new and might not be supported by some browsers

In both cases you need to set up a Windows Server Hosting from here Microsoft's download center