.net - Request from C# to Apache: The underlying connection was closed: An unexpected error occurred on a receive -


i have 2 linux apache servers running behind load balancer. on both apache server have installed same installation of yourls api shortening urls. sending request yourls api short url.

request these servers sent c# production site, shortening urls.

it worked fine months, , on request start receiving error:

the underlying connection closed: unexpected error occurred on receive.

nothing changed in meanwhile. apache server doesn't have security restriction or something.

this code request:

public dynamic sendrequest(string action, namevaluecollection parameters = null)     {          var client = new nokeepalivewebclient();         string jsonresult = string.empty;         dynamic result;          //we need form url requests         var data = new namevaluecollection();         data["format"] = "json";         data["action"] = action;         data["signature"] = this.key;          if (parameters != null)         {             foreach (string key in parameters)             {                 data[key] = parameters[key];             }         }          try         {             byte[] byteresult = client.uploadvalues(url, data);             jsonresult = encoding.utf8.getstring(byteresult);             dynamic tempresult = jobject.parse(jsonresult);              result = tempresult;         }         catch (exception ex)         {             logger.error("error sendrequest (action: {0}) json: {1}      {2}",                 action,                 jsonresult,                 ex.message + ex.stacktrace);             throw;         }          return result;     } 

i not getting error request, getting of them.

i don't know c#. responsible apache server, , cannot find on servers can block requests, or cause errors this.

so question is: can caused apache server or specific c#. or maybe have load balancer.

i guess question kind dumb, need know asap side causing problem.

edit

by adding more logs on c# side got detailed errors.

 errortype: webexception  errormessage: underlying connection closed: unexpected error occurred on receive.    innerexceptiontype: ioexception innerexceptionmessage: unable read data transport connection: existing connection forcibly closed remote host. 

edit

i concluded problem load balancer (hproxy)

i have 1 server on installed hproxy. hproxy serve 2 aplications servers. when sending requests on hproxy getting errors.

now stopped using hproxy , calling requests directly 1 aplications servers , works fine now, without errors. need works hproxy.

so idea, in hproxy can cause errors.


Popular posts from this blog