In one of my WCF-Services (stateless), I want to send a message via SignalR. Because the service is stateless, and the hub is on another machine, I connect to SignalR, send the message, and disconnect.
proxy.Connect().Wait();
proxy.SendMessageToUsers(receiverUserNames, message).Wait();
proxy.Disconnect();
From time to time, there are InvalidOperationExceptions (Connection was disconnected before invocation result was received).
I understand from this post (C# SignalR Exception - Connection started reconnecting before invocation result was received) that .Wait is not a good idea. But I think I need to wait for Connect and SendMessage to complete, before disconnect.
So, what else can I do?
Best regards, Stefan