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 SSL connection could not be established #122

Closed
ComputerMaster1st opened this issue May 19, 2018 · 12 comments
Closed

The SSL connection could not be established #122

ComputerMaster1st opened this issue May 19, 2018 · 12 comments

Comments

@ComputerMaster1st
Copy link

Hi There,

Here is the error with stacktrace...

System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception. ---> System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception. ---> System.ArgumentException: Decoded string is not a valid IDN name.
Parameter name: unicode
   at System.Globalization.IdnMapping.GetAsciiCore(String unicodeString, Char* unicode, Int32 count)
   at System.Globalization.IdnMapping.GetAscii(String unicode, Int32 index, Int32 count)
   at Interop.OpenSsl.AllocateSslContext(SslProtocols protocols, SafeX509Handle certHandle, SafeEvpPKeyHandle certKeyHandle, EncryptionPolicy policy, SslAuthenticationOptions sslAuthenticationOptions)
   at System.Net.Security.SafeDeleteSslContext..ctor(SafeFreeSslCredentials credential, SslAuthenticationOptions sslAuthenticationOptions)
   at System.Net.Security.SslStreamPal.HandshakeInternal(SafeFreeCredentials credential, SafeDeleteContext& context, SecurityBuffer inputBuffer, SecurityBuffer outputBuffer, SslAuthenticationOptions sslAuthenticationOptions)
   --- End of inner exception stack trace ---
   at System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, ExceptionDispatchInfo exception)
   at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)
   at System.Net.Security.SslStream.BeginAuthenticateAsClient(SslClientAuthenticationOptions sslClientAuthenticationOptions, CancellationToken cancellationToken, AsyncCallback asyncCallback, Object asyncState)
   at System.Net.Security.SslStream.<>c.<AuthenticateAsClientAsync>b__47_0(SslClientAuthenticationOptions arg1, CancellationToken arg2, AsyncCallback callback, Object state)
   at System.Threading.Tasks.TaskFactory`1.FromAsyncImpl[TArg1,TArg2](Func`5 beginMethod, Func`2 endFunction, Action`1 endAction, TArg1 arg1, TArg2 arg2, Object state, TaskCreationOptions creationOptions)
   at System.Threading.Tasks.TaskFactory.FromAsync[TArg1,TArg2](Func`5 beginMethod, Action`1 endMethod, TArg1 arg1, TArg2 arg2, Object state, TaskCreationOptions creationOptions)
   at System.Threading.Tasks.TaskFactory.FromAsync[TArg1,TArg2](Func`5 beginMethod, Action`1 endMethod, TArg1 arg1, TArg2 arg2, Object state)
   at System.Net.Security.SslStream.AuthenticateAsClientAsync(SslClientAuthenticationOptions sslClientAuthenticationOptions, CancellationToken cancellationToken)
   at System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(Stream stream, SslClientAuthenticationOptions sslOptions, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(Stream stream, SslClientAuthenticationOptions sslOptions, CancellationToken cancellationToken)
   at System.Threading.Tasks.ValueTask`1.get_Result()
   at System.Net.Http.HttpConnectionPool.CreateConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Threading.Tasks.ValueTask`1.get_Result()
   at System.Net.Http.HttpConnectionPool.WaitForCreatedConnectionAsync(ValueTask`1 creationTask)
   at System.Threading.Tasks.ValueTask`1.get_Result()
   at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.DecompressionHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
   at YoutubeExplode.Internal.HttpClientEx.HeadAsync(HttpClient client, String requestUri)
   at YoutubeExplode.YoutubeClient.GetVideoMediaStreamInfosAsync(String videoId)
   at AudioChord.Processors.YouTubeProcessor.ProcessAudioAsync() in C:\Users\ComputerMaster1st\Documents\GitHub\RailgunVB\Shared.Music\src\AudioChord\Processors\YouTubeProcessor.cs:line 45
   at AudioChord.Collections.SongCollection.DownloadFromYouTubeAsync(String url) in C:\Users\ComputerMaster1st\Documents\GitHub\RailgunVB\Shared.Music\src\AudioChord\Collections\SongCollection.cs:line 113
   at AudioChord.MusicService.DownloadSongFromYouTubeAsync(String url) in C:\Users\ComputerMaster1st\Documents\GitHub\RailgunVB\Shared.Music\src\AudioChord\MusicService.cs:line 144
   at RailgunVB.Music.MusicPlay.Url(String Input) in C:\Users\ComputerMaster1st\Documents\GitHub\RailgunVB\RailgunVB\RailgunVB\Command\Music\MusicPlay.vb:line 139

This occurred after upgrading to .NETCore 2.1

@Tyrrrz
Copy link
Owner

Tyrrrz commented May 19, 2018

Perhaps related to #109
Try downgrading to .NET Core 2.0

@ComputerMaster1st
Copy link
Author

ComputerMaster1st commented May 19, 2018

Unable to downgrade due to another package I use breaks with 2.0.

EDIT: The sockets in 2.1 are needed for it to function.

@stefancreed37
Copy link

Create new project.

@Tyrrrz
Copy link
Owner

Tyrrrz commented May 19, 2018

I have no idea why this happens but this is an issue that appears only on .NET Core 2.1 preview, afaik.

@ComputerMaster1st
Copy link
Author

Allow me to rephrase that...

The package I use which can only work on 2.1 is Discord.Net (Discord changed voice infrastructure for one region and requires 2.1 to function correctly).

The problem with YE is found on HttpClientEx Line 35

@SlowLogicBoy
Copy link
Contributor

This is not YE issue, this is an issue with new HttpClient on .Net Core 2.1 SDK preview which is not supported. If you can't downgrade to netstandard2.0 you could try reverting HttpClient to an old one. How to do this is written here: https://blogs.msdn.microsoft.com/dotnet/2018/04/11/announcing-net-core-2-1-preview-2/

@ComputerMaster1st
Copy link
Author

Where should this "AppContext" code be written?

@ComputerMaster1st
Copy link
Author

Sorted.

@Tyrrrz
Copy link
Owner

Tyrrrz commented May 20, 2018

Can the issue be closed?

@ComputerMaster1st
Copy link
Author

ComputerMaster1st commented May 20, 2018

-Case Closed-

@jpprobr
Copy link

jpprobr commented Nov 6, 2019

was this issue fixed ?

@ComputerMaster1st
Copy link
Author

Hi There,

This issue has been fixed since NETCore 3 was released.

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

No branches or pull requests

5 participants