This will only work, as far as I am aware, when you are calling the hub from within the web application.
In order to interact with the hub from outside of the web application, e.g. from a Windows Service, you will need to take a look at the SignalR Client Hubs documentation
Add the following NuGet package to your project: Microsoft.AspNet.SignalR.Client
Add the following statement to the top of your page: using Microsoft.AspNet.SignalR.Client;
You would need to create a connection to the hub, and then start the connection.
var connection = new HubConnection("http://mysite/");
IHubProxy myHub = connection.CreateHubProxy("MyHub");
connection.Start().Wait(); // not sure if you need this if you are simply posting to the hub
myHub.Invoke("addNewMessageToPage", "Hello World");
In your hub you would then need to have a method for AddNewMessageToPage
which accepts the hello world string and from here call Clients.All.addNewMessageTopage(message)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…