Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The underlying connection was closed: An unexpected error occurred on a send. #51

Open
sarahbenjamin opened this issue Apr 24, 2018 · 5 comments

Comments

@sarahbenjamin
Copy link

I am using the c# code and upon this line the connection was closed error message is thrown. What am I doing wrong?

HttpWebResponse response = (HttpWebResponse)request.GetResponse()

Using the sample code.

@k2s
Copy link

k2s commented Sep 23, 2018

duplicate of #42

@bhadana-rajesh
Copy link

I am using c# code and still seeing same issue, can someone update the sample code. or let me know what i am doing wrong ?

@karnati8
Copy link

I am also getting this all of a sudden. The same code worked last year on v1, but it is not working on v2 and gives this same error on the same line.

Yes, I do have this in:
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;

And I'm using .Net 2.6.2

My sample code:

string apiPath = "/api/v2/tickets/1";
string fdDomain = "my_domain";
string apiKey = "my_api_key";
string jsonString = String.Empty; ;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://" + fdDomain + ".freshdesk.com" + apiPath);
request.ContentType = "application/json";
request.Method = "GET";
string authInfo = apiKey + ":X";
authInfo = Convert.ToBase64String(Encoding.Default.GetBytes(authInfo));
request.Headers["Authorization"] = "Basic " + authInfo;

        ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
        
        DataSet dsFreshdeskData = new DataSet();
        try
        {
            using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
            {

....

@vinodkumartheking
Copy link

DId any one found the exact solution for the issue ? i am getting response when we change .Net 4 and TLS1

@Dev-blin
Copy link

Hi Exactly the same issue I have.

ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;

This line also does not work for me. Also upgrade the .net Framework to 4.7 which didnt work.

Kindly someone post your solution here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants