My impression of one of the big benefits of Owin is that it makes it easy to run different web frameworks side-by-side without IIS's IHttpHandler
. (This would be huge for distributing vertical functionality slices as nuget features.)
However every tutorial and article I find talks of things like self-host and a single framework. This is not what I'm interested in, I'm interested in running mvc, nancy, web api, maybe even webforms in the same application.
Am I wrong about OWIN enabling this? Say I want
How would I configure my Startup
class to enable this?
Although the use case sounds a bit absurd, you're absolutely right that OWIN enables this. You can compose your pipeline in all kinds of crazy ways.
A typical "straight" pipeline would look something like this:
public class Startup
{
public void Configuration(IAppBuilder app)
{
app.UseWebApi(new MyHttpConfiguration());
app.MapSignalR();
app.UseNancy();
}
}
This will work as follows (given you're hosting on http://localhost/
)
http://localhost/api/*
(default routing)http://localhost/signalr
(default route)http://localhost/*
(will handle everything else)You can also create branches in your pipeline:
public class Startup
{
public void Configuration(IAppBuilder app)
{
app.UseWebApi(new MyHttpConfiguration());
app.Map("/newSite", site =>
{
site.MapSignalR();
site.UseNancy();
});
}
}
This will work as follows (given you're hosting on http://localhost/
)
http://localhost/api/*
(default routing)http://localhost/newSite/signalr
(default route)http://localhost/newSite/*
(will handle everything else)If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With