diff --git a/src/Servers/Kestrel/Transport.Quic/src/Internal/QuicConnectionListener.cs b/src/Servers/Kestrel/Transport.Quic/src/Internal/QuicConnectionListener.cs
index 11866cb40405..ef5b4781dd33 100644
--- a/src/Servers/Kestrel/Transport.Quic/src/Internal/QuicConnectionListener.cs
+++ b/src/Servers/Kestrel/Transport.Quic/src/Internal/QuicConnectionListener.cs
@@ -36,7 +36,7 @@ public QuicConnectionListener(
{
if (!QuicListener.IsSupported)
{
- throw new NotSupportedException("QUIC is not supported or enabled on this platform. See https://aka.ms/aspnet/kestrel/http3reqs for details.");
+ throw new NotSupportedException("QUIC and HTTP/3 are not supported or enabled on this platform. See https://aka.ms/aspnet/kestrel/http3reqs for details.");
}
if (endpoint is not IPEndPoint listenEndPoint)
diff --git a/src/Servers/Kestrel/Transport.Quic/src/WebHostBuilderQuicExtensions.cs b/src/Servers/Kestrel/Transport.Quic/src/WebHostBuilderQuicExtensions.cs
index ad59ed4f999b..571b28da3517 100644
--- a/src/Servers/Kestrel/Transport.Quic/src/WebHostBuilderQuicExtensions.cs
+++ b/src/Servers/Kestrel/Transport.Quic/src/WebHostBuilderQuicExtensions.cs
@@ -1,7 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
-using System.Net.Quic;
using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.Server.Kestrel.Transport.Quic;
using Microsoft.Extensions.DependencyInjection;
@@ -20,15 +19,11 @@ public static class WebHostBuilderQuicExtensions
/// The .
public static IWebHostBuilder UseQuic(this IWebHostBuilder hostBuilder)
{
- if (QuicListener.IsSupported)
+ // QuicListener.IsSupported has performance costs. Always register the QUIC factory and then check for support when binding an endpoint.
+ return hostBuilder.ConfigureServices(services =>
{
- return hostBuilder.ConfigureServices(services =>
- {
- services.AddSingleton();
- });
- }
-
- return hostBuilder;
+ services.AddSingleton();
+ });
}
///