Dmitry

Dmitry

  • NA
  • 1
  • 0

asynchronous svc service calls from javascript

May 14 2010 7:43 AM

Hi

I got a problem with my svc service in asp.net site. I do file uploading in iframe and the same time do calls to svc service to check the uploading progress.

The problem is that service does not start processing of the request until file is fully uploaded.

I checked forums for "concurrent service calls" and found ServiceBehavior and CallbackBehavior settings there. I also written a test page and test service to process two calls simultaneously. Mentioned settings don't help and I heed advice!


Below is my svc service


Below is my svc service

[ServiceContract(Namespace = "")]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
[ServiceBehavior(InstanceContextMode=InstanceContextMode.PerSession, ConcurrencyMode=ConcurrencyMode.Multiple, UseSynchronizationContext=false)]
[CallbackBehavior(ConcurrencyMode=ConcurrencyMode.Multiple, UseSynchronizationContext=false)]
public class MessageService
{
[OperationContract]
public string GetFileUploadsProgress(string MessageID)
{
System.Diagnostics.Debug.WriteLine("GetFileUploadsProgress - begin {0}", MessageID);
System.Threading.Thread.Sleep(1000);
System.Diagnostics.Debug.WriteLine("GetFileUploadsProgress - end {0}", MessageID);
//return S;
return MessageID + " - Ok";
}


there is how I call it:

function serviceCall() {
    MessageService.GetFileUploadsProgress("test", updateProgress);
}

function updateProgress(result) {
    document.getElementById("progress").innerHTML += "<br>" + result;
}
On the test page I have a button. I quickly click it three times and look at firebug console.

Results always come with reply time around 1sec, 2sec, 3sec. That mean the service calls ALWAYS synchronously go one by one. The third reply waits for previous two to finish.

 

What should I do to make service answer on requests regardless on other calls, posting pages and so on???

Please help!!!!