質問

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top