Question

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?

Était-ce utile?

La solution

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top