Two weeks before we had an authorization issue for API,as the JIRA Key got expired. We have updated the new key in Production config file. Since then, we have been facing this issue and after analysis we got the "Underlying connection closed " which is the actual error. I have also tried with Application Pool restart in Production servers, but still the same result.
But the same API works fine in localmachine using PostMan(REST Client) and in stage server as well. This api fails only in production server.
we are using C#.Net - Rest Client to call JIRA API, below are the details
try { RestClient client = new RestClient(ConfigurationManager.AppSettings["JiraUri"]); RestRequest request = new RestRequest(resource, method); request.AddHeader("Authorization", "Basic " + JiraAuthentication); request.AddHeader("Content-Type", "application/json"); request.AddHeader("Accept", "application/json"); request.RequestFormat = DataFormat.Json; if (requestBody != null) { request.AddBody(requestBody); } var response = client.Execute<T>(request); if(response.StatusCode == System.Net.HttpStatusCode.OK && response.Data != null) return response.Data; else { emailBody += "Status Code: " + response.StatusCode + "\n Error Message:" + response.ErrorMessage + "\n"; SendEmail("Admin@xxxx.com", "firstName.lastName@trane.com", "Error in accesing JIRA API", emailBody); throw new Exception(response.ErrorMessage); } } catch (Exception ex) { throw new Exception(ex.Message); }
The Sample URI is as below:
https://projectName.jira.com/rest/api/2/issue/AVC-3173
Error we get when we call JIRA API:
Status Code: 0 Error Message:The underlying connection was closed: An unexpected error occurred on a send.
Please help me in fixing this issue.
Code 0 means that there is no response. Check:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.