1

I have Web API application in which I need to send notification using SignalR Hub to application site.

Web api

HubConnection connection = new HubConnection("http://localhost:52620/");
var hub = connection.CreateHubProxy("TestHub");
if (connection.State == ConnectionState.Disconnected)
{
    await connection.Start();
}
await hub.Invoke("SendNotifications", Id.ToString());

Web application

public class TestHub : Hub
{
    public void SendNotifications(string Id)
    { }
} 

But notification not appended in application. What have I missed in this ?

It returns method not found exception.

enter image description here

Note: I am using different solution file and hosted separately in iis in same server for web api and web application site

Cœur
  • 37,241
  • 25
  • 195
  • 267
Rahini Krishna
  • 93
  • 2
  • 15
  • https://stackoverflow.com/questions/41504667/group-chat-signal-r-with-web-api/41505473#41505473 Check the answer here it could help – Deniz Gokce Sep 11 '17 at 08:09
  • I am using different solution for web api and web application site. – Rahini Krishna Sep 11 '17 at 08:41
  • I don't think this is a good solution. Since you are recreating connection for every call for this API if the apps are on the same server you can access with a static method if not use the call from client directly SignalR is not intended for server to server communication. – Filip Cordas Sep 11 '17 at 09:23

0 Answers0