我正在使用NET6 C#实现C#服务器,并尝试添加QUIC协议
services.Configure<KestrelServerOptions>(serverOptions =>
{
serverOptions.ListenAnyIP(900, o =>
{
o.Protocols = HttpProtocols.Http1AndHttp2AndHttp3;
o.UseHttps();
});
serverOptions.ListenAnyIP(890, o =>
{
o.Protocols = HttpProtocols.Http3;
o.UseHttps();
});
});
服务器部署在Amazon上。sudo yum install -y libmsquic
启动。但我收到的例外情况如下
Unhandled exception. System.InvalidOperationException: This platform doesn't support QUIC or HTTP/3.
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.<>c__DisplayClass30_0`1.<<StartAsync>g__OnBind|0>d.MoveNext()
请告诉我,我错过了什么?
发布于 2022-09-16 19:41:51
微软文档称NET 6 is only compatible with the 1.9.x versions of libmsquic. Libmsquic 2.x is not compatible due to breaking changes. Libmsquic receives updates to 1.9.x when needed to incorporate security fixes.
sudo yum install -y libmsquic-1.9*
使用o.Protocols = HttpProtocols.Http3;
Kestrel的其他用户不要打开端口。也就是说我们需要HttpProtocols.Http1AndHttp2AndHttp3;
https://stackoverflow.com/questions/73736969
复制相似问题