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

HttpRequestException when used on Windows with .Net 8.0 #34

Closed
MaiRat opened this issue Oct 8, 2024 · 6 comments
Closed

HttpRequestException when used on Windows with .Net 8.0 #34

MaiRat opened this issue Oct 8, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@MaiRat
Copy link

MaiRat commented Oct 8, 2024

The examples cause the following exception when used:

System.Net.Http.HttpRequestException: 'An internal error has occurred. ConfigurationLoadCredential failed: Unknown (0x80090331) (generativelanguage.googleapis.com:443)'

If I set the 'DefaultVersionPolicy' to 'HttpVersionPolicy.RequestVersionExact' (in GenerativeModel.cs) to force HTTP/1.1, it works. Also works with HTTP/2.0. So, it seems to be an issue with HTTP/3.0?!

@jochenkirstaetter jochenkirstaetter added the bug Something isn't working label Oct 8, 2024
@jochenkirstaetter
Copy link
Contributor

Hi @MaiRat

Thanks for flagging this. I'll have a look.

As for HTTP/3.0, there might be pre-requisite depending on the OS as described by Microsoft. The HttpClient uses libmsquic internally. See here: https://learn.microsoft.com/en-us/dotnet/fundamentals/networking/quic/quic-overview

@jochenkirstaetter
Copy link
Contributor

Hello @MaiRat

Could it be that you're using an older version?
The initialization of the HttpClient had been changed on 19th September. See here:

private static readonly Version _httpVersion = HttpVersion.Version11;
private static readonly HttpClient Client = new HttpClient(new SocketsHttpHandler
{
PooledConnectionLifetime = TimeSpan.FromMinutes(30),
EnableMultipleHttp2Connections = true
})
{
DefaultRequestVersion = _httpVersion,
DefaultVersionPolicy = HttpVersionPolicy.RequestVersionOrHigher
};

This was released in version 1.6.2.

@MaiRat
Copy link
Author

MaiRat commented Oct 17, 2024

Hello @jochenkirstaetter,

I am using Version 1.6.4. By adding the following in my code, all is fine (without HTTP3 Support):

AppContext.SetSwitch("System.Net.SocketsHttpHandler.Http3Support", false);

Otherwise, I can't get QUIC to work. I am on Windows 11 24H2, latest updates, latest Studio 2022 17.11.5. I added all mentioned RegKeys from the MSQUIC info-site, copied the dll in my folder and the windows\system32 folder (correct architecture), but nothing works (dism with checkimagehealth and sfc doesnt find any issues)

@jochenkirstaetter
Copy link
Contributor

For reference, it's an issue with how the QuicConnection is currently implemented.

dotnet/runtime#87478

@jochenkirstaetter
Copy link
Contributor

jochenkirstaetter commented Oct 29, 2024

And it seems to be fixed for .NET 9.0
icerpc/icerpc-csharp#3991
dotnet/runtime#94211

@jochenkirstaetter
Copy link
Contributor

Disabled HTTP/3 & Quic due to .NET 8.0 and earlier.
Remains enabled in .NET 9.0

See Release v1.8.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants