ECONNRESET for response.write with return with postman time to time

Viewed 3046

I am working with asp.net 2.0 ashx page that has this code at server side and at client side postman method:

try {
    if (Request.RequestType == "GET")
    {
            //..        
    }else if (Request.RequestType == "POST"){       
        if (restMethod == "PostSomeAction"){    
            //some code ...
            if (pifFirma == null){
                MyCustomResponse myCustomResponse = new MyCustomResponse();
                myCustomResponse.Code = "NoFirmFound";
                myCustomResponse.Message = "No firm was found incoming ip address";
                Response.Write(JsonConvert.SerializeObject(myCustomResponse));
                Response.StatusCode = (int)HttpStatusCode.Forbidden;
                Response.ContentType = "application/json";
                //Response.Flush() //it seems this line gives always ECONNRESET 
                return;
            }
            //..rest of code
        }
    }

}catch (Exception ex){
    MyCustomResponse myCustomResponse = new MyCustomResponse();
    myCustomResponse.Code = "ErrorOccured";
    myCustomResponse.Message = "Some Error Occured";
    Response.Write(JsonConvert.SerializeObject(myCustomResponse));
    Response.StatusCode = (int)HttpStatusCode.InternalServerError;
    Response.ContentType = "application/json";
    return; 
}

At postman when I do post action to "PostSomeAction" it gives ECONNRESET time to time and return json message sometimes.

It seems when I uncomment Response.Flush(), it seems it is always ECONNRESET but not sure.

And on the other hand, probably at I codes in catch execute, it returns json message successfully.

Finally, when the code reaches to the end with out any "return", it seems it always return json message successfully

What can be cause having ECONNRESET message from postman in above cases? if ssl is the issue should it not give always error. How can be "return" expression factor to this?

1 Answers

Issue seems completely related to postman. With curl no similar issue never happened.

To do this with curl just do in depicted picture:

enter image description here

enter image description here

Related