none
WCF client and compact framework RRS feed

  • Question

  • I have a .Net CF 3.5 application that runs on Win CE 6.0 and communicates with a WCF service.

    It connects and gets data works but sometimes it throws the following exception:

      at System.Net.HttpWebRequest.GetResponse()
       at
    System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
       at
    System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
       at
    System.ServiceModel.Channels.RequestChannel.Request(Message message)
       at
    Microsoft.Tools.ServiceModel.CFClientBase`1.getReply(Message msg)
       at Microsoft.Tools.ServiceModel.CFClientBase`
    1.Invoke[TREQUEST,TRESPONSE](CFInvokeInfo

    Can anyone help me?

    Friday, June 5, 2015 9:05 AM

Answers

  • Hi erik_bullens,

    According to your description, in my opinion you should increased the timeouts with the server and clients. Then, may be you should set maxReceivedMessageSize is max with the server and clients. Next, you shoudl ensure your client has  established  a connection after use to close.Otherwise, the connection will  turn off after the set of sessions (the automatic response time is 10 minutes ) in this period of time any client is unable to use this service.Another case is that the connect number is out of the range of your WCF service.
    So can you check your project about the following which will cause the connect to WCF service timeout :
    ====================================
    1). Close the connection to WCF service everytime after it's opened and finished. For the connection will not close automaticaly util 10 minutes (default) , and the services couldn't be connected again during this time. For example , check your code about this :

    ServiceClient client = new ServiceClient("DefaultBinding_IService");
    client.Open();
    client.DoWork();
    client.Close();
    Remember to add client.Close();  after the connection is completed.

    2). You can set the configuration file to increase the max connection number (maxConcurrentCalls,maxConcurrentSessions,maxConcurrentInstances) , like this:

    <serviceThrottlingmaxConcurrentCalls="20" maxConcurrentSessions="20"

    maxConcurrentInstances="30"/>

    This node should be added as a child of the service behavior node (<behavior>).
    ====================================
    I hope that will be helpful to you.

    Best Regards,

    Tracy Dj

    Friday, June 26, 2015 7:15 AM
    Moderator

All replies

  • Hi  erik_bullens ,
        According to this case, you can try to increase the sendTimeOut and ReceiveTimeOut binding properties into their corresponding config file like below :

    <configuration>
    ...
      <system.serviceModel>
    ..
        <bindings>
          <basicHttpBinding>
            <binding name="EnableHttpBinding" closeTimeout="00:05:00" openTimeout="00:05:00"
              receiveTimeout="01:00:00" sendTimeout="00:05:00" maxBufferPoolSize="2147483647"
              maxReceivedMessageSize="2147483647" >
            </binding>
          </basicHttpBinding>
        </bindings>
        ..
      </system.serviceModel>
    ..
    </configuration>
    

    Moreover I suggest you to enable the WCF Tracing & logging which helps to find out the further exception.
    Click here to refer about the Tracing and Message Logging in WCF.

    Monday, June 8, 2015 9:18 AM
  • Hi,

    I increased the timeouts but the same problem

    Also the error occurs  directly and not after the timeout. Also in the logging no trace.

    More ideas?

    Tuesday, June 16, 2015 12:20 PM
  • Hi erik_bullens,

    According to your description, in my opinion you should increased the timeouts with the server and clients. Then, may be you should set maxReceivedMessageSize is max with the server and clients. Next, you shoudl ensure your client has  established  a connection after use to close.Otherwise, the connection will  turn off after the set of sessions (the automatic response time is 10 minutes ) in this period of time any client is unable to use this service.Another case is that the connect number is out of the range of your WCF service.
    So can you check your project about the following which will cause the connect to WCF service timeout :
    ====================================
    1). Close the connection to WCF service everytime after it's opened and finished. For the connection will not close automaticaly util 10 minutes (default) , and the services couldn't be connected again during this time. For example , check your code about this :

    ServiceClient client = new ServiceClient("DefaultBinding_IService");
    client.Open();
    client.DoWork();
    client.Close();
    Remember to add client.Close();  after the connection is completed.

    2). You can set the configuration file to increase the max connection number (maxConcurrentCalls,maxConcurrentSessions,maxConcurrentInstances) , like this:

    <serviceThrottlingmaxConcurrentCalls="20" maxConcurrentSessions="20"

    maxConcurrentInstances="30"/>

    This node should be added as a child of the service behavior node (<behavior>).
    ====================================
    I hope that will be helpful to you.

    Best Regards,

    Tracy Dj

    Friday, June 26, 2015 7:15 AM
    Moderator
  • Hi Tracy,

    Thx for the reply

    I already closed every connection. But the throttling settings were the standard ones. i will change them and test the application.

    Friday, June 26, 2015 8:55 AM
  • Hi erik_bullens,

    You can try it.


    Best Regards, Tracy Dj

    Tuesday, July 14, 2015 2:46 AM
    Moderator