我的客户端gRPC向我的gRPC服务器发送多个请求,但第一个请求崩溃,并出现RpcException:
Status(StatusCode=“Unavailable”,Detail=“Error starting gRPC call. HttpRequestException:发生内部错误。ConfigurationLoadCredential失败:未知(0x80090331)(localhost:5057)QuicException:发生内部错误。ConfigurationLoadCredential失败:Unknown(0x80090331)",DebugException=“System.Net.Http.HttpRequestException:发生内部错误。ConfigurationLoadCredential失败:未知(0x80090331)(localhost:5057)”)
接下来的请求不会崩溃。客户端应用程序和服务器应用程序在Windows Server 2022上运行,并作为Windows服务安装。
在事件查看器上记录错误:
创建TLS客户端凭据时发生致命错误。内部错误状态为10013。
在Windows 10和Windows Server 2019上,没有请求崩溃......这很奇怪。
gRPC客户端(我不使用证书进行测试):
services.AddGrpcClient<ShipmentProtoService.ShipmentProtoServiceClient>(o =>
{
o.Address = new Uri("my uri"));
})
.ConfigureChannel(op =>
{
var httpClientHandler = new HttpClientHandler();
httpClientHandler.ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator;
op.HttpHandler = httpClientHandler;
});
gRPC服务器:
services.AddGrpc(opt =>
{
opt.EnableDetailedErrors = true;
opt.Interceptors.Add<LoggerInterceptor>();
opt.Interceptors.Add<ExceptionInterceptor>();
});
1条答案
按热度按时间nhaq1z211#
我测试了向Windows Server 2019发送数百个gRPC请求,没有遇到任何错误。当我在Windows Server 2022上执行相同的测试时,我收到了错误:
'创建TLS客户端凭据时出现不可恢复的错误。内部错误状态为10013。'
两台服务器上使用的协议相同:TLS 1.1、TLS 1.2和TLS 1.3。在等待理解问题的同时,我使用Polly库在出现错误时重试发送请求。