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.
Straight Pipeline
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/
)
- WebAPI -
http://localhost/api/*
(default routing)
- SignalR -
http://localhost/signalr
(default route)
- Nancy -
http://localhost/*
(will handle everything else)
Branched Pipeline
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/
)
- WebAPI -
http://localhost/api/*
(default routing)
- SignalR -
http://localhost/newSite/signalr
(default route)
- Nancy -
http://localhost/newSite/*
(will handle everything else)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…