0

Problem: I'm working on a Silverlight application, and I'm loading lots of data into a DomainContext, i.e. from a Web Service. It starts off running a few different queries, with BusyIndicator displaying the current query, but when it gets to the query with the most data, it freezes. After a few minutes it says that the server doesn't respond to the next query.

Debug/attempted solutions: The system works when I load less data. I assume that it times out, and that is why it says that the next query doesn't exist, i.e. it can't even contact the web service. I looked around for a while, and people suggested increasing timeout and max result size. These have solved other issues, so I know they work (i.e. that they are being applied), but it doesn't solve this problem.

I tried isolating the problem to make sure that it wasn't some other silly problem that had nothing to do with loading the data. The problems occurs when returning from the query function in the web service (return result; below), i.e. there shouldn't be a problem with the web service itself. So both the debug prints are executed, and the second one says 2726 elements.

Web service code:

public IQueryable<Person> GetPeopleWithSubscription()
{
    Debug.WriteLine("Before");
    IQueryable<Person> result = test();
    Debug.WriteLine("After " + result.Count().ToString());
    return result;
}

private IQueryable<Person> test()
{
    return this.ObjectContext.People.Where(p =>
        p.Subscriptions.Count > 0 ||
        p.Subscriptions1.Count > 0 ||
        p.ID < 0);
}

Calling code:

...
_context.Load(_context.GetSubscriptionTypesQuery(), DataLoaded, false);
...

Also, the problem appears to be on the client side, because an old client (i.e. before the problem occurred) still works with the new server. However, I've been going through the diffs in the repository from since the problem occurred, and I can't find anything that should make a difference (not saying it isn't there).

Can anyone help me with this problem? If you need more information, please let me know.

Bjørn Vårdal
  • 174
  • 2
  • 11

1 Answers1

0

Having read recently how the WCF framework works and on the philosophy behind it. Microsoft does not suggest playing with the timeout time specially if you are blocking the GUI. They advocate that if the call takes more than 60 seconds to complete a redesign might be required. Have you considered using paging, I understand that this ui pattern might not apply to all kinds of data but if you are loading that much data it seems improbable that the user will need to see it all at the same time.

I had a similar issue come up to me a couple weeks back and we changed the web-service implementation to to perform the multiple insert it was required using a multi-threaded design. This allowed us to bring the processing time of the service down to less than the 60 seconds.

Hopefully this is will help you,

Cheers,

Stainedart
  • 1,929
  • 4
  • 32
  • 53