Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple Web Applications within Self Hosted Owin/Katana Application

Tags:

owin

katana

I'm working on an application that uses Katana to expose self-hosted WebAPI services. I'd like to manage content similarly to the way IIS allows multiple applications under a single web site.

For example, I may have three folders containing web api content:

  • C:\SelfHost\App1
  • C:\SelfHost\App2
  • C:\SelfHost\App3

Each of these folders will be a stand-alone application, with web.config, controllers, routing, etc.

I can spawn a new Owin instance for each of these, but that would require separate ports. With IIS, I can configure separate applications so that http://localhost:8080/App1 will route to the first app, http://localhost:8080/App2 will route to the second, and so forth. Is anything similar possible with Owin/Katana?

like image 262
Glen Hughes Avatar asked Oct 19 '22 21:10

Glen Hughes


1 Answers

It is possible to run Owin instances that share ports. You just need to make sure the WebApps are started with their own specific URLs, for example:

Microsoft.Owin.Hosting.WebApp.Start<App1Startup>("http://localhost:8080/App1");
Microsoft.Owin.Hosting.WebApp.Start<App2Startup>("http://localhost:8080/App2");

You can start these in either the same or separate processes, and requests will be routed to the correct instance automatically.

I've not found any official documentation to explain this, but it is easy to prove by following the Getting Started With Owin and Katana guide, and extending it by registering multiple applications as above.

like image 163
notracs Avatar answered Oct 21 '22 21:10

notracs