0
votes

I am calling WCF service from web application. It works fine for local webservice. When service deployed to dev server, it gives me above error. Webservice returns List of custom objects in xml format.

[OperationContract()]
    [WebInvoke(Method = "POST", UriTemplate = "/track/get", ResponseFormat = WebMessageFormat.Xml)]
    List<tokenCount> GetTracking(System.IO.Stream data);

If I return just a string from webservice, it works fine. Other operations in webservice work fine.

        oRequest.ContentLength = aBytes.Length;
        oRequest.KeepAlive = false;
        oRequest.ProtocolVersion = HttpVersion.Version10;
        oRequest.ConnectionGroupName = Guid.NewGuid().ToString();
        oRequest.Timeout = 60000; 
        using (Stream oRequestStream = oRequest.GetRequestStream())
        {
            oRequestStream.Write(aBytes, 0, aBytes.Length);               
            using (HttpWebResponse oResponse = (HttpWebResponse)oRequest.GetResponse())
            {
                using (StreamReader oReader = new StreamReader(oResponse.GetResponseStream(), Encoding.UTF8))
                {
                    Response.ContentType = "application/xml";                     
                    //resDoc = CreateMetaFile(oReader.ReadToEnd());
                    string r = oReader.ReadToEnd(); 
                }
            }
        }
1

1 Answers

2
votes

How many objects are you returning??

If that number gets high, you could run into two problems:

  • timeout: the server could take too long to get the answer ready and WCF will terminate the call
  • size: your size could exceed the settings for maxReceivedMessageSize on your client and thus be aborted