Silverlight + RIA Services: How to return from one invoke operation before another invoke operation completes?

StackOverflow https://stackoverflow.com/questions/18542552

Question

I am having trouble polling to get the status of a long running invoke operation in my domain service. Specifically, all calls to the invoke operation function used to poll for the status are not returning until after the long running invoke operation finishes.

Here are the details:

  1. I am using Silverlight 5 with RIA Services.
  2. On my server side domain service class (example code below), I have a long running operation in an invoke operation named RunLongOperation.
  3. I also have a second invoke operation function named CheckStatusOfLongOperation that retrieves the status of the long running operation.
  4. In my Silverlight client, I call RunLongOperation. After that, every 5 seconds, I call CheckStatusOfLongOperation.
  5. According to Fiddler, every 5 seconds, CheckStatusOfLongOperation is being called. However, there is no response for any of the calls until RunLongOperation is complete.

What can I do to get CheckStatusOfLongOperation to return sooner?

ASP.NET Server code:

Public Class MyDomainService
    Inherits DomainService

    <Invoke()>
    Public Function RunLongOperation() As String

        'Long running operation, some database queries,
        'but mostly in-memory operations

    End Function

    <Invoke()>
    Public Function CheckStatusOfLongOperation() As String

        'Checks a single variable and return status

    End Function

End Class
Était-ce utile?

La solution

You are probably seeing locking on the session state. Check here for instructions on how to turn off locking: http://blogs.microsoft.co.il/blogs/idof/archive/2010/09/27/asp-net-compatible-wcf-services-concurrency-problem.aspx

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top