asp.net-coreasp.net-core-webapiiis-8kestrel-http-server

How can I have multiple ASP.NET Core APIs running on a single website?


My website is hosted at a provider running IIS.

Instead of creating a single, ubiquitous web application, I'd like to create multiple, separate micro services and store them in different folders of my website, like this:

- Static Content (HTML, CSS, JavaScript)
|-- ASP.NET Core application #1
|-- ASP.NET Core application #2
|-- ASP.NET Core application #3

How can I do this?

EDIT

The question to me is: What do I need to configure in IIS to have /folder1/* requests be handled by webApi1 (i.e. Kestrel), /folder2/* requests be handled by webApi2 (Kestrel again) and /* requests by IIS itself. — And what path would I need to provide to app.MapGet(""), app.MapPost("") etc.


Solution

  • This is impossible. If you want to host multiple ASP.NET Core applications in a single iis website, there will definitely be errors.

    My suggestion is to use url rewrite.