문제

I'm new to SignalR and am trying send push notifications to a Silverlight client.

Our web project is NOT Asp.Net MVC - just ASP.NET.

I have created a simple Hub class:

 [HubName("ServerHub")] 
public class ServerHub: Hub
{
    public Task SendMessage(string message)
    {
        return Clients.NewMessage(message);
    }
}

The problem is that we've got some messages coming through to our web server via message queues (Rhino Service Bus). When a message is processed, we want to send a notification to the UI. But the RSB worker thread is running outside of the HttpContext, so when invoking the SendMessage method the Clients property is null.

I have tried to work around this by adding the ServerHub to the Http Cache, and then retrieve it from the Message Consumer. Still having same issue - Hub's properties are null.

Any suggestions?

Thanks.

도움이 되었습니까?

해결책

Ok, was doing it wrong. Hadn't used GlobalHost.DependencyResolver.Resolve().

Regards.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top