Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# MVC WinForm Services
I created a project with winforms and used the mvp pattern.
The WCF service handles the data control.
From Bussines objects tot Data Transfer objects and back.
Everything works fine until the return statement.
 
Tested it with an sql statement that shows less customers.
Found the problem but can't figure out a solution without throwing the whole pattern over.
It shows up to 149 customers. When I change the criteria in the sql statement, to more then 149 records to show then it stops at return response and goes in Time Out after 10 minutes.
Maybe a limit on the capacity?

 
This is a method in the model that is used to make the request and the response.
 
public IList<KlantModel> GetKlanten(string sortExpression)
{
    var request = PrepareRequest(new KlantRequest());
 
    request.LoadOptions = new string[] { "Klanten" };
    request.Criteria = new KlantCriteria { SortExpression = sortExpression };
    var response = Client.GetKlanten(request);
 
    //if (response.CorrelationId != request.RequestId)
    //    throw new ApplicationException("GetKlanten: RequestId and CorrelationId do not match.");

    //if (response.Acknowledge != AcknowledgeType.Success)
    //    throw new ApplicationException(response.Message);

    return Mapper.FromDataTransferObjects(response.Klanten);
}
 
The request works gets all the data with the wcf.service.
But when the service wants to return the response. It doesn't give an error but goes in time out after 10 min. (See code below)
 
        public KlantResponse GetKlanten(KlantRequest request)
        {            
            var response = new KlantResponse(request.RequestId);
 
                IEnumerable<Klant> klanten;
                klanten = _klantDao.GetKlanten(sort);
 
                response.Klanten = klanten.Select(c => 
                //Transfer BO to DTO
                DataTransferObjectMapper.Mapper.ToDataTransferObject(c)).ToList();
            //This is the part where it doesn't do anything anymore
            return response;
        }
 
The web.config is configured also .
 
<system.serviceModel>
    <services>
      <service behaviorConfiguration="behaviorAction" name="NameSpace.Service">
        <endpoint binding="wsHttpBinding" bindingConfiguration="bindingAction" contract="NameSpace.IService">
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="behaviorAction">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
      <wsHttpBinding>
        <binding name="bindingAction" transactionFlow="false" sendTimeout="00:30:00" receiveTimeout="00:30:00">
          <reliableSession enabled="true"/>
        </binding>
      </wsHttpBinding>
    </bindings>
  </system.serviceModel>
</servicemodel>
 
the response is handled with the response class. Klantrequest.cs
 
[DataContract(Namespace = "http://www.yourcompany.com/types/")]
public class KlantRequest : RequestBase
{
    /// <summary>
    /// Selection criteria and sort order
    /// </summary>
    [DataMember]
    public KlantCriteria Criteria;
 
    /// <summary>
    /// Klant object.
    /// </summary>
    [DataMember]
    public KlantDto Klant;
}
 

Does anyone knows how it comes that just the return doesn't work without any error?
 
Thanks in advance.
Posted 23-Aug-12 0:04am
Edited 26-Aug-12 23:32pm
v6
Comments
sjelen at 24-Aug-12 9:10am
   
Hard to tell what is the problem from this. Have you tried to debug WCF? What happens when you step over "klanten.Select ..." statement?
deurebokkn at 27-Aug-12 5:30am
   
Tested it with an sql statement that shows less customers.
Found the problem but can't figure out a solution without throwing the whole pattern over.
It shows up to 149 customers. When I change the criteria in the sql statement, to more then 149 records to show then it stops at return response and goes in Time Out after 10 minutes.
sjelen at 28-Aug-12 7:37am
   
Looks like WCF is having trouble serializing your data. Either your data is too big or you may have circular references in your data structure.
How big is your Klant object? What does it contain?
What exactly does DataTransferObjectMapper.Mapper.ToDataTransferObject methode do? (code)
If you're hosting your service on IIS check it's logs and EventViewer for errors.
deurebokkn at 28-Aug-12 10:44am
   
Thanks a lot for helping.

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Worked out.
 
Did change app.config in both the model and the Starters project. (had to change in both app.configs)
 
What changed:
- Time out all to 10 minutes.
- the readerQuotas.
- maxBufferPoolSize and maxReceivedMessageSize.
 
<binding name="WSHttpBinding_IOVAService" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
  <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
  <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="true"/>
</binding>
 
Thanks a lot for helping.
  Permalink  
Comments
Amund Gjersøe at 28-Aug-12 14:18pm
   
I had the same issue some weeks ago, and I can't understand why the readerQuotas aren't defined by default.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web02 | 2.8.140721.1 | Last Updated 28 Aug 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100