Getting exceptions when executing TestSet_Retrieve() function

Monday, August 11, 2014


I'm running into some issues in regards to retrieving all of the available test sets. Seem like if I try to retrieve 400 test sets and above, I start getting exceptions. Is there something wrong with my HTTP binding? I have tried to change the parameters to no avail. Below is the method I execute and the exception:

public bool connect2SpiraServer()


            spiraexport = new SpiraWebServices.ImportExportClient();

            BasicHttpBinding httpBinding = (BasicHttpBinding)spiraexport.Endpoint.Binding;

            httpBinding.AllowCookies = true;

            httpBinding.Security.Mode = BasicHttpSecurityMode.None;

            httpBinding.MaxReceivedMessageSize = 9999999; 

            httpBinding.ReceiveTimeout = new TimeSpan(0, 10, 0);

            httpBinding.SendTimeout = new TimeSpan(0, 1, 0);

            httpBinding.CloseTimeout = new TimeSpan(0, 1, 0);

            httpBinding.OpenTimeout = new TimeSpan(0, 1, 0);

            httpBinding.BypassProxyOnLocal = false;

            httpBinding.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard;

            httpBinding.MaxBufferSize = 9999999;

            httpBinding.MaxBufferPoolSize = 9999999;

            httpBinding.TransferMode = TransferMode.Buffered;

            Boolean connectToServer = spiraexport.Connection_Authenticate(username, password);


    testSets = spiraexport.TestSet_Retrieve(null, 1, 400);



"An error occurred while receiving the HTTP response to http://usmaspiraweb/SpiraTeam/Services/v4_0/ImportExport.svc. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details."

Inner Exception:

“The underlying connection was closed: An unexpected error occurred on a receive.”

“Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.”

Server stack trace:

   at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)

   at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)

   at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)

   at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)

   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)

   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)

   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]:

2 Replies
Tuesday, August 19, 2014
re: DmitrijG Monday, August 11, 2014
Hi Dmitri

This error message often means that the size of the data packet being return is larger than the maximum allowed in your request.
So, either increase the size of httpBinding.MaxReceivedMessageSize (to Int32.Max) or reduce the pagination size of the request.

Friday, August 22, 2014
re: inflectra.jimx Tuesday, August 19, 2014

I have tried increasing the MaxReceivedMessageSize with no success, still get the same exception. How would I go about reducing the pagination size of the request? If there is any documentation regarding retrieval of large number of TestCases or TestSets, I would definitely appreciate a reference to it. 

Spira Helps You Deliver Quality Software, Faster and With Lower Risk

And if you have any questions, please email or call us at +1 (202) 558-6885


  • Started: Monday, August 11, 2014
  • Last Reply: Friday, August 22, 2014
  • Replies: 2
  • Views: 2610