首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法建立HTTP/2连接,因为服务器没有完成HTTP/2握手gRPC微服务.net核心

无法建立HTTP/2连接,因为服务器没有完成HTTP/2握手gRPC微服务.net核心
EN

Stack Overflow用户
提问于 2022-09-05 03:50:44
回答 1查看 197关注 0票数 0

我已经尝试在我的笔记本电脑本地主机上运行两个连接的gRPC微服务。这两个微服务是WorkflowService和UserManagementService。WorkflowService在端口44394中运行。UserManagementService运行在端口4432 2中。WorkflowService需要在processhistory API中点击UserManagementService。我试图用邮递员访问processhistory API,但是我得到了以下消息:

代码语言:javascript
复制
Grpc.Core.RpcException: Status(StatusCode="Unavailable", Detail="Error starting gRPC call. HttpRequestException: An error occurred while sending the request. IOException: The request was aborted. IOException: An HTTP/2 connection could not be established because the server did not complete the HTTP/2 handshake. IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.. SocketException: An existing connection was forcibly closed by the remote host.", DebugException="System.Net.Http.HttpRequestException: An error occurred while sending the request.
 ---> System.IO.IOException: The request was aborted.
 ---> System.IO.IOException: An HTTP/2 connection could not be established because the server did not complete the HTTP/2 handshake.
 ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host..
 ---> System.Net.Sockets.SocketException (10054): An existing connection was forcibly closed by the remote host.
   --- End of inner exception stack trace ---
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.GetResult(Int16 token)
   at System.Net.Http.Http2Connection.ReadFrameAsync(Boolean initialFrame)
   at System.Net.Http.Http2Connection.ProcessIncomingFramesAsync()
   --- End of inner exception stack trace ---
   at System.Net.Http.Http2Connection.ProcessIncomingFramesAsync()
   --- End of inner exception stack trace ---
   at System.Net.Http.Http2Connection.SendHeadersAsync(HttpRequestMessage request, CancellationToken cancellationToken, Boolean mustFlush)
   at System.Net.Http.Http2Connection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.Http2Connection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at Grpc.Shared.TelemetryHeaderHandler.SendAsyncCore(HttpRequestMessage request, CancellationToken cancellationToken)
   at Grpc.Net.Client.Internal.GrpcCall`2.RunCall(HttpRequestMessage request, Nullable`1 timeout)")
   at Grpc.Net.Client.Internal.HttpClientCallInvoker.BlockingUnaryCall[TRequest,TResponse](Method`2 method, String host, CallOptions options, TRequest request)
   at Grpc.Core.Interceptors.InterceptingCallInvoker.<BlockingUnaryCall>b__3_0[TRequest,TResponse](TRequest req, ClientInterceptorContext`2 ctx)
   at Grpc.Core.ClientBase.ClientBaseConfiguration.ClientBaseConfigurationInterceptor.BlockingUnaryCall[TRequest,TResponse](TRequest request, ClientInterceptorContext`2 context, BlockingUnaryCallContinuation`2 continuation)
   at Grpc.Core.Interceptors.InterceptingCallInvoker.BlockingUnaryCall[TRequest,TResponse](Method`2 method, String host, CallOptions options, TRequest request)
   at UserManagementService.Protos.GetUserDataGrpcService.GetUserDataGrpcServiceClient.GetUserData(GetUserDataRequest request, CallOptions options) in C:\Users\s.janaka\source\repos\vip-pln\MS-WorkflowService\WorkflowService\obj\Debug\net5.0\Protos\Get-user-dataGrpc.cs:line 98
   at UserManagementService.Protos.GetUserDataGrpcService.GetUserDataGrpcServiceClient.GetUserData(GetUserDataRequest request, Metadata headers, Nullable`1 deadline, CancellationToken cancellationToken) in C:\Users\s.janaka\source\repos\vip-pln\MS-WorkflowService\WorkflowService\obj\Debug\net5.0\Protos\Get-user-dataGrpc.cs:line 94
   at WorkflowService.Adaptor.UserManagementServiceAdaptor.GetUserByUserId(Int32 userId, HttpContext context) in C:\Users\s.janaka\source\repos\vip-pln\MS-WorkflowService\WorkflowService\Adaptor\UserManagementServiceAdaptor.cs:line 46
   at WorkflowService.Authorization.JwtMiddleware.Invoke(HttpContext context, IUserManagementServiceAdaptor userManagementAdaptor, ICustomAuthenticationHelperUtility authenticationUtils) in C:\Users\s.janaka\source\repos\vip-pln\MS-WorkflowService\WorkflowService\Authorization\JwtMiddleware.cs:line 30
   at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

我已经尝试通过在命令提示符中执行以下命令来强制执行信任ASP.NET核心HTTPS开发证书:

dotnet dev-certs https --trust

但我还是从邮递员那里得到了同样的信息。我做错什么了?请帮帮我,我需要在我的笔记本电脑上运行连接的微服务,以便调试代码。任何帮助都将不胜感激。

EN

回答 1

Stack Overflow用户

发布于 2022-09-08 02:41:26

我的问题解决了。结果发现,在ServiceConfig设置中,有一个设置我必须对其进行调整。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73604387

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档