SignalR doesn't work inside WebApi self-host #277

Closed
mj1856 opened this Issue Mar 29, 2012 · 11 comments

Projects

None yet

7 participants

@mj1856
mj1856 commented Mar 29, 2012

I have an app where I need to use both Asp.Net WebApi, and SignalR in a self-hosted manner. Currently, this means that I have to run two separate self-host processes on different ports.

I should be able to use the AspNet WebApi self-host and have SignalR bolted on, but WebApi uses HttpRoutes, while SignalR expects a regular Route. So you can't use the routes.MapConnection() on the WebApi configuration's routing table.

WebApi's self host is superior anyway, because it has support for message handlers. The best that SignalR's self host has is Server.OnProcessRequest, and you can't cancel a request there without it throwing an exception and crashing the server.

In my opinion, There should be extension methods in the SignalR.Hosting.AspNet package that allow it to work with the WebApi self-host server - or there should be a SignalR.Hosting.WebApi package.

Thanks.

@davidfowl
Member

We're working on webapi integration that will make this smoother. Also, it seems you're confused as to what self hosting SignalR means. We're not providing a full http stack, it's purely for SignalR interaction. So I agree, WebApi is superior because it's a full http stack 😄.

@davidfowl davidfowl was assigned May 7, 2012
@davidfowl davidfowl closed this May 7, 2012
@davidfowl davidfowl reopened this May 7, 2012
@DamianEdwards
Member

This will be supported via OWIN in a future release.

@dealproc

Noticed that you have the stuff posted for OWIN. any cookie crumbs you and @davidfowl can add to the docs on how we get SignalR and ASP.Net Web API to exist nicely in a self hosted scenario @DamianEdwards ???

@DamianEdwards
Member

We plan to have a specific nuget package for the RC2 release that pulls in all the pieces required for self-hosting SignalR using OWIN and HttpListener. That should clear things up quite a bit.

@sshannon

Just wondering if you could update us on the status of this issue now that RC2 has been released? Are there any docs on how to achieve this or is it still a backlog item?

@bsurela
bsurela commented May 21, 2013

what is the status of this issue, i am hosting singalR and webapi on windows service and singalr does not work....

@sshannon

@bsurela - it's been a few months since I've looked at this, but as far as I recall what you're trying to do should now work. You might need the SignalR OWIN packages to do it..

@davidfowl
Member

@bsurela You need to use the WebApi owin host which is currently is preview state.

@pksorensen

Just came across this when searching on google. Anyone who got an example of doing this with owin with 2.0 release candidate of signalr and webapi.

@DamianEdwards
Member

@s093294 we have a pre-release doc on using OWIN self-host with 2.0 http://www.asp.net/signalr/overview/getting-started/tutorial-signalr-self-host

@pksorensen

Thanks. I got it working. My Startup class can be found at https://gist.github.com/s093294/6457561 if someone else want to run webapi/signalr together (and using the Owin.Cors also).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment