0
votes

We are trying to setup an owin self host service for multiple applications (app1, app2).

We'd like to use the same behavior of IIS where one application pool uses one AppDomain per application.

Here is the code we use:

using (WebApp.Start<WebServerStartup>(url: "http://localhost:9000/")) { ... }

... and the WebServerStartup implementation:

internal class WebServerStartup
{
    public void Configuration(IAppBuilder appBuilder)
    {
        // Configure Web API for self-host. 
        var config = new HttpConfiguration();
        config.Routes.MapHttpRoute(
            name: "DefaultApi",
            routeTemplate: "api/{controller}/{id}",
            defaults: new { id = RouteParameter.Optional }
        );

        appBuilder.UseWebApi(config);
    }

How can we use multiple AppDomains for each application? Is there a way to declare multiple webapps using Webapp.Start(...) in separate AppDomains that would share the same port? Or is there some way to route the requests to various appdomains somehow by defining a route like app/api/{controller}/{id} instead of api/{controller}/{id}?

Thanks

1

1 Answers

0
votes

There's no built in support for running the apps in separate domains. You'd want to start each new AppDomain and then run WebApp.Start inside.