I've been trying to call a method on my hub from a signalr .Net client however it throws the following exception:
[ArgumentNullException: Value cannot be null.
Parameter name: s]
System.IO.StringReader..ctor(String s) +10894409
Microsoft.AspNet.SignalR.Json.JsonSerializerExtensions.Parse(JsonSerializer serializer, String json) +63
Microsoft.AspNet.SignalR.Hubs.HubRequestParser.Parse(String data, JsonSerializer serializer) +19
Microsoft.AspNet.SignalR.Hubs.HubDispatcher.OnReceived(IRequest request, String connectionId, String data) +40
Microsoft.AspNet.SignalR.<>c__DisplayClassc.<ProcessRequest>b__7() +34
Microsoft.AspNet.SignalR.TaskAsyncHelper.FromMethod(Func`1 func) +28
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52
Microsoft.AspNet.SignalR.Transports.<ProcessSendRequest>d__10.MoveNext() +364
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52
Microsoft.Owin.Mapping.<Invoke>d__0.MoveNext() +386
Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.StageAsyncResult.End(IAsyncResult ar) +69
Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContext.EndFinalWork(IAsyncResult ar) +64
System.Web.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +415
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
This is when I try to invoke the method on a remote host, the weird thing when developing it it actually does work locally...
Here is the code of the hub:
public void UpdateLocalPlayerName(string name)
{
...
foreach (var connection in websiteConnections)
{
Clients.Client(connection.ConnectionID).UpdateLocalPlayerName(Context.ConnectionId, name);
}
}
And here is how I try to invoke it with the .Net client
public void UpdateLocalPlayerName(string name)
{
MainHubProxy.Invoke<string>("UpdateLocalPlayerName", name);
}
I am using 2.0.3.0 version of the .Net client and the server runs IIS8...
Any idea what causes this?
Seems to be I had www. infront of the server's url I was connecting to, guess the routing prevented the arguments from being passed correctly. Changed the url to the url without www and it worked.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.