0

Not able to hit the service and getting the below error:

An existing connection was forcibly closed by the remote host.

I am hitting a POST-OData service with some data. When I input the data within 1 minute, the service hits successfully and the data is posted. But when I input the data in more than a minute, I am getting this error. The SQL server is being used. The service doesn't get hit in this case.

$.ajax({
  url: "/Non_SAP_Instrumentation/odata/LoopDrawing",
  method: "POST",
  data: {
    "UnitNumber": unit_no,
    "TagName": tag_name,
    "SysTagName": sys_tag_name,
    "TagDesc": tag_description,
    "JbNo": jb_no,
    "JbPairNo": jb_pair_no,
    "JbTerminal": jb_terminal,
    "IoType": io_type,
    "Ctrl": controller,
    "Node": node,
    "Slot": slot,
    "Channel": channel,
    "Segment": segment,
    "Redundancy": redundancy,
    "MarCab": marsh_cab,
    "SurgeProtc": surge_protc,
    "Barrier": barrier,
    "Relay": relay,
    "FuseTbGrp": fuse_tb_group,
    "FuseTbTerm": fuse_tb_term,
    "Update": "No",
    "CreatedBy": that.name,
    "CreatedByID": that.EmpModel.getProperty("/").name,
    "ModifiedBy": that.name,
    "ModifiedByID": that.EmpModel.getProperty("/").name
  },
  dataType: "json",
  success: function(data) {
    var value = JSON.parse(data.value);
    sap.ui.core.BusyIndicator.hide();
    if (value.Status == "OK") {
      MessageBox.information("Loop Drawing has been created", {
        onClose: function() {
          that.router.navTo("TagMasterPage", {
            TAG: tag_name
          });
          that.makingFieldsBlank();
          that.window.location.reload();
        }
      });
    } else {
      sap.ui.core.BusyIndicator.hide();
      MessageBox.information("Unable to create Loop Drawing", {
        onClose: function() {
          that.router.navTo("SearchOrCreate");
          that.window.location.reload();
        }
      });
    }
  },
  error: function(err) {
    sap.ui.core.BusyIndicator.hide();
    console.log(err.responseText);
    MessageBox.information("Unable to create Loop Drawing", {
      onClose: function() {
        that.router.navTo("SearchOrCreate");
      }
    });
  }
Inizio
  • 2,226
  • 15
  • 18
Swappy
  • 160
  • 1
  • 7
  • 29
  • 1
    I'm guessing the server is built to have an automatic connection-close after 1 minute of connection without data input? – FeaturedSpace May 30 '19 at 13:42
  • @FeaturedSpace I don't have the knowledge about server configurations. But can I handle it on the code side ? – Swappy May 31 '19 at 04:40
  • Please see the answer at: https://stackoverflow.com/questions/2582036/an-existing-connection-was-forcibly-closed-by-the-remote-host - it's not language specific, but related to TCP/IP... In addition to using wireshark to see exactly what's going on, you may be able to use "Fiddler" to examing the client/server exchange or the developer bar's network view if you haven't already. – Ben A. Hilleli May 31 '19 at 04:58
  • Above: but related to TCP/IP but related to TCP/IP CONNECTIONS that are kept open for a prolonged period (among other things) You also mention SQL Server, could it be TOE/Chimney? It's 1 root cause to eliminate, see: https://blogs.msdn.microsoft.com/sql_protocols/2008/04/08/understanding-connection-forcibly-closed-by-remote-host-errors-caused-by-toechimney/ – Ben A. Hilleli May 31 '19 at 05:04

1 Answers1

0

This can be achieved by the following steps : 1) Go to IIS 2) Go to the advance settings on Web Applications 3) select the Connection limit and set the connection timeout.

But it decreases the performance of the server. So the connection timeout limit should be set minimum accordingly.

Swappy
  • 160
  • 1
  • 7
  • 29