I wrote a self-hosted SignalR app (a windows service). Now I want to add NancyFx to this app for handling the UI - a self-sufficient, drop-in web app without any external dependencies.
I know we can have a self-hosted SignalR app. Also we can have a self-hosted NancyFx app.
Now, how to combine these two in one app? Which one should host which one?
Use Owin, it will make things easier. In terms of examples you can look at:
https://github.com/damianh/NancySignalrOwin
That's probably the easiest / best example.
Basically you want to create a startup file and specify a path for Nancy to use.
public partial class Startup
{
public void Configuration(IAppBuilder app)
{
app.Map("/site", siteBuilder => siteBuilder.UseNancy())
.MapSignalR();
}
}
Then start your WebApplication normally in your program file or where ever you start it. And SignalR and Nancy will be picked up.
Edit: Map/MapPath come from Microsoft.Owin package.
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