mscraftsman / generative-ai

Gemini AI SDK for .NET and ASP.NET Core enables developers to use Google's state-of-the-art generative AI models to build AI-powered features and applications.
https://mscraftsman.github.io/generative-ai/
Apache License 2.0
48 stars 9 forks source link

HttpRequestException when used on Windows with .Net 8.0 #34

Open MaiRat opened 2 days ago

MaiRat commented 2 days ago

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 commented 2 days ago

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