SignalR/Silverlight: Start must be called before data can be sent.
I have the following client code (Silverlight 4):
HubConnection hubConnection; IHubProxy alertHub; hubConnection = new HubConnection("http://localhost:59805/"); alertHub = hubConnection.CreateProxy("alertservice"); Task startTask = hubConnection.Start().ContinueWith(task => { if (task.IsFaulted) { } alertHub.Invoke("NewMessage", "asdf", "jkl").Wait(); });
And the following server code (hosted in ASP.Net web project):
[HubName("alertservice")] public class AlertServiceHub : Hub { public void NewMessage(string userName, string messageText) { Clients.AddMessage(userName, messageText); } }
On the alertHub.Invoke
method, I get the error "Start must be called before data can be sent."
The strange thing is, when I check Fiddler on the connection attempt, the following is returned (note "Connection: Close"):
HTTP/1.1 200 OK Server: ASP.NET Development Server/10.0.0.0 Date: Tue, 14 Aug 2012 15:11:29 GMT X-AspNet-Version: 4.0.30319 Transfer-Encoding: chunked Cache-Control: no-cache Pragma: no-cache Expires: -1 Content-Type: text/event-stream Connection: Close
Answers & Comments...
No comments:
Post a Comment
Send us your comment related to the topic mentioned on the blog