locked
Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host RRS feed

  • Question

  • User1459630356 posted

    I created a webservice, after that create a winapp, add service references to webservice. I run winapp ok in my local, but I met this error in a test server (about 5 minutes when call webservice)

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

    I set <httpRuntime maxRequestLength="1048576"/> for the webservice. The ServiceFunction takes about 10 minutes to complete.

    Here is my winapp code.

    Thanks

    private void button1_Click(object sender, EventArgs e)
    {
    MyReportServiceSoapClient client = GetReportServiceSoapClient();
    client.ServiceFunction("test");
    }

    private MyReportServiceSoapClient GetReportServiceSoapClient()
    {
    BasicHttpBinding bd = new BasicHttpBinding();
    bd.MaxBufferPoolSize = bd.MaxReceivedMessageSize = 8388608;
    bd.ReceiveTimeout = bd.SendTimeout = new TimeSpan(2, 0, 0);

    string webServiceUrl = "http://localhost/MyReportService/MyReportService.asmx";
    EndpointAddress ep = new EndpointAddress(webServiceUrl);
    MyReportServiceSoapClient clientService = new MyReportServiceSoapClient(bd, ep);
    foreach (OperationDescription op in clientService.ChannelFactory.Endpoint.Contract.Operations)
    {
    DataContractSerializerOperationBehavior dataContractBehavior = op.Behaviors.Find<DataContractSerializerOperationBehavior>() as DataContractSerializerOperationBehavior;
    if (dataContractBehavior != null)
    {
    dataContractBehavior.MaxItemsInObjectGraph = 1048576;
    }
    }

    return clientService;
    }
    Wednesday, September 23, 2009 3:10 AM

Answers

  • User1696475319 posted

    I suggest you run a trace log.  Look at this page, scroll down halfway.  You'll find an XML Node to add to your config file.  Then run that method.  Run it, wait for it to time out.  As you do it, an SVCLog file is created.  Once the operation times out, look at the SVCLog file (there's a log viewer file that already comes with the .NET framework), and at some point, you'll find an exception in there, which should show you why it's happening.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, September 25, 2009 3:23 AM

All replies

  • User-1659704165 posted

    Hi,

    Just Chk UR Firewall or any Antivirus is Blocking Your communcation

    OR

    connect the servcie providr

    Wednesday, September 23, 2009 6:01 AM
  • User1696475319 posted

    What is the timeout specified in the client's config file and the service's config file?

    Wednesday, September 23, 2009 5:54 PM
  • User1459630356 posted

    You can see that in my source code, I set to 2h

    Thursday, September 24, 2009 11:16 PM
  • User1696475319 posted

    I suggest you run a trace log.  Look at this page, scroll down halfway.  You'll find an XML Node to add to your config file.  Then run that method.  Run it, wait for it to time out.  As you do it, an SVCLog file is created.  Once the operation times out, look at the SVCLog file (there's a log viewer file that already comes with the .NET framework), and at some point, you'll find an exception in there, which should show you why it's happening.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, September 25, 2009 3:23 AM
  • User-1484187403 posted

    I see no such thing at that link; the word "trace" does not appear on the page, nor does "SVCLog," and the only XML (which *is*, indeed, about halfway down the page) is not what you state. Is the link wrong? Has the article changed that much over time? Or...???

    Friday, November 8, 2013 4:52 PM