1
votes

I have a WCF service, that is called from my Silverlight 3 application (with C#). The service is called for each item in a user filled listbox. When only one item is contained in the listbox, everything works fine. Multiple items cause an error sometimes. I tested a bit around and sometimes I get an error with 2 items, sometimes not. With 4 items test, one time I get 2 results returned, after that the error.

Worst thing, that the error simply says "The Remoteserver has returned an Error: NotFound". The Error is a "CommunicationException" and is thrown in the EndMethod(System.IAsyncResult result) method

Here's the call:

foreach (ListBoxItem lbItem in categorySeeds)
{
    Helper.Instance.service.ClusterAsync(Helper.Instance.language.value,
     ((KeyValuePair<string, int>)lbItem.Tag).Value,
     Helper.Instance.clusterLevel,
     Helper.Instance.clusterDelay,
     Helper.Instance.clusterTolerance,
     Helper.Instance.clusterMaxCategories,
     Helper.Instance.similarity);
}

I remember that I once "solved" the problem by calling "reuse" of the AppPool that contained my WCF ... so maybe there is something wrong with the configuration? Does anyone know if I can make the WCF returning a more meaningful error message than just "NotFound"?

Thanks in advance, Frank

ANSWER: The problem was caused by the concurrent access of the multiple WCF-Service-Calls. The service calls StoredProcedures that work with a Synonym-Objects that each SP changes to a value given by a parameter ... so I have to fix it there.

2

2 Answers

2
votes

The WCF server will have a maximum number of concurrent calls and concurrent sessions, which are 10 and 16 respectively. If you call that service too quickly with more than that number of calls, you could get timeouts and/or messages being rejected.

This is a service behavior (serviceThrottling) which is indeed configurable on the server:

<serviceBehaviors>
   <behavior name="YourServiceBehavior">
       <serviceDebug includeExceptionDetailInFaults="True" />
       <serviceThrottling 
          maxConcurrentCalls="25"
          maxConcurrentInstances="25"
          maxConcurrentSessions="25"/>
   </behavior>
</serviceBehaviors>

The generic error message you get back from WCF is totally on purpose - the WCF designers didn't want to reveal anything to an outside caller that might help him to exploit your system. That, too, can be tweaked by a service behavior, which then returns a more meaningful error message to you:

<serviceBehaviors>
   <behavior name="YourServiceBehavior">
       <serviceDebug includeExceptionDetailInFaults="True" />
   </behavior>
</serviceBehaviors>
2
votes

You need to dispose the service after you call it. I had the same issue and i fixed it with using statement -

using (TempConvertService TMPConSvc =
new TempConvertService.TempConvertServiceClient())
{
result = TMPConSvc.ConvertToF(32.00);
return result;
}