Kaveh Shahbazian
Kaveh Shahbazian

Reputation: 13523

Developing a Self-Hosted SignalR+NancyFx

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?

Upvotes: 5

Views: 3152

Answers (1)

Phill
Phill

Reputation: 18794

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.

Upvotes: 5

Related Questions