Santhosh

Santhosh

  • NA
  • 300
  • 136.5k

System.AggregateException' in mscorlib.dll in SignalR

Dec 20 2016 6:52 AM
Hi,
 
I want to send data to my console application wich have a connection to my "LocationHub". I tried to do as described in example from  a link but got no result.
 
Client Side Code is:
------------------------- 
public class Provider
{
static void Main(string[] args)
{
var connection = new HubConnection("http://192.168.1.88:8044/");
var myHub = connection.CreateHubProxy("LocationHub");
//This line it displaying Exception thrown: 'System.AggregateException' in mscorlib.dll 
connection.Start().Wait();
myHub.On<string>("addMessage", myString =>
{
Console.WriteLine("This is client getting messages from server :{0}", myString);
});
myHub.Invoke("Chatter", System.DateTime.Now.ToString()).Wait();
Console.Read();
}
}
 
Server side code is:
-----------------------
class Program
{
static void Main(string[] args)
{
string url = "http://192.168.1.88:8044/";
using (WebApp.Start<Startup>(url))
{
Console.WriteLine("Server running on {0}", url);
Console.ReadLine();
IHubContext context = GlobalHost.ConnectionManager.GetHubContext<LocationHub>();
for (int i = 0; i < 100; i++)
{
System.Threading.Thread.Sleep(3000);
context.Clients.All.addMessage("Current integer value : " + i.ToString());
}
Console.ReadLine();
}
}
}
[HubName("LocationHub")]
public class LocationHub : Hub
{
public void Send(string platform, string message)
{
Clients.All.messageReceived(platform, message);
}
}
}
public class Startup
{
public void Configuration(IAppBuilder app)
{
app.MapSignalR();
}
}
 
 Error:
 Exception thrown: 'System.AggregateException' in mscorlib.dll
Additional information: One or more errors occurred.
 
Inner Exception is:
 {"StatusCode: 404, ReasonPhrase: 'Not Found', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:\r\n{\r\n Cache-Control: private\r\n Date: Tue, 20 Dec 2016 09:09:06 GMT\r\n Server: Microsoft-IIS/10.0\r\n X-Powered-By: ASP.NET\r\n Content-Length: 4938\r\n Content-Type: text/html; charset=utf-8\r\n}"}
 
What is the best solution for implementing this and what is the reason why i am not able to invoke the client method?

Answers (1)