Answer the question
In order to leave comments, you need to log in
How to disable SSL when using WebClient?
Greetings, stranger!
I wrote a small console application for working with a telegram bot. And it works great on my laptop. But on the PC that I am going to use as a server for the application, an error occurs during the execution of this code:
try {
var webClient = new WebClient();
webClient.DownloadString($"{startUrl}/sendMessage?chat_id={messageFromId}&text=" + number.ToString());
}
catch (Exception e){
Console.WriteLine(e.ToString());
}
> System.Net.WebException: The SSL connection could not be established,
> see inner exception. Unable to read data from the transport
> connection: Удаленный хост принудительно разорвал существующее
> подключение.. ---> System.Net.Http.HttpRequestException: The SSL
> connection could not be established, see inner exception. --->
> System.IO.IOException: Unable to read data from the transport
> connection: Удаленный хост принудительно разорвал существующее
> подключение.. ---> System.Net.Sockets.SocketException (10054):
> Удаленный хост принудительно разорвал существующее подключение. ---
> End of inner exception stack trace --- at
> System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError
> error, CancellationToken cancellationToken) at
> System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.GetResult(Int16
> token) at System.Net.FixedSizeReader.ReadPacketAsync(Stream
> transport, AsyncProtocolRequest request) at
> System.Net.Security.SslStream.ThrowIfExceptional() at
> System.Net.Security.SslStream.InternalEndProcessAuthentication(LazyAsyncResult
> lazyResult) at
> System.Net.Security.SslStream.EndProcessAuthentication(IAsyncResult
> result) at
> System.Net.Security.SslStream.EndAuthenticateAsClient(IAsyncResult
> asyncResult) at
> System.Net.Security.SslStream.<>c.<AuthenticateAsClientAsync>b__65_1(IAsyncResult
> iar) at
> System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult
> iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean
> requiresSynchronization)
> --- End of stack trace from previous location where exception was thrown ---
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question