Reputation: 91
I am using SignalR.Hubs to connect to a hub called "MyHub", I have my hub hosted in IIS with Virtual directory "MyVD": This is the way, I am trying to connect to the hub:
var conn = new HubConnection("http://localhost/MyVD");
var hub = conn.CreateProxy("MyHub");
hub.On<string>("MyMethod", message => Deployment.Current.Dispatcher.BeginInvoke(() => _messages.Add(message)));
conn.Start();
When, I do this, I am getting exception with the message "The remote server returned an error: NotFound."
at System.Net.Browser.ClientHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at SignalR.Client.Http.HttpHelper.<>c_DisplayClass2.b_0(IAsyncResult ar)
at System.Threading.Tasks.TaskFactory1.FromAsyncCoreLogic(IAsyncResult iar, Func
2
endFunction, Action1 endAction, Task
1 promise).
Please note, I am able to negotiate to the hub, when i run it directly in the Visual studio (Off course, I change the url to point to the local dev server) any help, would be greatly appreciated.
Thanks, Alpee
Upvotes: 2
Views: 1602
Reputation: 128
I fought some errors like this last night and found that the hub that is running in IIS and the client that is connecting to it must be running the same version of the SignalR packages. I had originally been using a demo program I had downloaded, and when I created my hub server to host in IIS, I had used nuGet to get the latest version (not pre-release.) When I updated the demo project's packages to those on nuGet, I was able to connect.
The other thing I had to do was add the crossdomain.xml file to the ROOT of the IIS website in order to allow Silverlight to connect.
Hope that helps!
Cindy K.
Upvotes: 0
Reputation: 91
Just to add another point:
I am able to negoiate with the hub in my silverlight client, if i use the dlls from : http://chris.59north.com/post/2011/12/15/SignalR-and-Silverlight.aspx After i replace all the dlls with the latest ones from the github, I am getting the error as mentioned above. Please note instead of Signalr.Client.SilverLight.dll, i am using Signalr.Client.SilverLight5.dll and the System.Threading.Tasks.SL5.dll.
Thanks, Alpee
Upvotes: 1