7

I have some problem when proceed downloading or uploading file (WebClient.DownloadFileAsync|UploadFileAsync or by HttpWebRequest) and simultaneously calling SignalR-hub methods:

SignalR calls were stopped until file loading finished. It seems like that: all signalr calls enqueuing. All enqueued calls are performed further (after file loading).

My code fragment:

hubProxy.Invoke("TraceDocumentUploadingRequest", callerId, fileName, "File loading started ", 0);

DownloadFileByKey(fileKey, (progressPercentage, bytesSent) => { hubProxy.Invoke("TraceDocumentUploadingRequest", callerId, fileName, "File loading in progress", progressPercentage); });

hubProxy.Invoke("TraceDocumentUploadingRequest", callerId, fileName, "File loading finished", 100);

Second "TraceDocumentUploadingRequest" hub method call (in file load handler) will be executed on the hub after file downloading completion.

File load handler executes both in current thread or in another (related on DownloadFileByKey method realization) - result is the same.

How I can avoid this behavior and force hub-method calls at the right time?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Dmitry
  • 71
  • 2

1 Answers1

0

To summarize David Fowl's comments, the issue was a bug in SignalR version 1.1.3 but fixed in later version. Specifically version 2.0.0

Stephen
  • 131
  • 2
  • 15