gpt4 book ai didi

.net - 为 Azure Function App 启用 VNet 集成时出现 "Http2ConnectionException: HTTP/2 error code ' PROTOCOL_ERROR ' (0x1)"错误

转载 作者:行者123 更新时间:2023-12-03 05:17:55 27 4
gpt4 key购买 nike

在 Azure Function App 上启用 VNet 集成以通过专用终结点与出站内部服务进行通信时,会发生 HTTP 502 错误网关或 HTTP 504 网关超时错误。如果我们禁用 VNet 集成,函数应用程序将开始正常工作。

这是我们的配置图:

Diagrams of Working and Not Working Architectures

在日志中,我们看到以下内容:

2022-10-14T15:04:59.443 [Information] Host initialized (1052ms)
2022-10-14T15:04:59.458 [Information] Host started (1107ms)
2022-10-14T15:04:59.459 [Information] Job host started
2022-10-14T15:04:59.500 [Debug] Debug file watch initialized.
2022-10-14T15:04:59.511 [Debug] Diagnostic file watch initialized.
2022-10-14T15:04:59.512 [Debug] Hosting started
2022-10-14T15:05:02.400 [Error] Unhandled exception. System.IO.IOException: The request was aborted.
2022-10-14T15:05:02.413 [Error] ---> System.Net.Http.Http2ConnectionException: The HTTP/2 server sent invalid data on the connection. HTTP/2 error code 'PROTOCOL_ERROR' (0x1).
2022-10-14T15:05:02.418 [Error] at System.Net.Http.Http2Connection.ThrowProtocolError(Http2ProtocolErrorCode errorCode)
2022-10-14T15:05:02.425 [Information] at System.Net.Http.Http2Connection.ReadFrameAsync(Boolean initialFrame)
2022-10-14T15:05:02.425 [Information] at System.Net.Http.Http2Connection.ProcessIncomingFramesAsync()
2022-10-14T15:05:02.425 [Information] --- End of inner exception stack trace ---
2022-10-14T15:05:02.425 [Information] at System.Net.Http.Http2Connection.ThrowRequestAborted(Exception innerException)
2022-10-14T15:05:02.425 [Information] at System.Net.Http.Http2Connection.Http2Stream.SendDataAsync(ReadOnlyMemory`1 buffer, CancellationToken cancellationToken)
2022-10-14T15:05:02.425 [Information] at Grpc.Net.Client.StreamExtensions.WriteMessageAsync[TMessage](Stream stream, GrpcCall call, TMessage message, Action`2 serializer, CallOptions callOptions)
2022-10-14T15:05:02.425 [Information] at Grpc.Net.Client.Internal.HttpContentClientStreamWriter`2.WriteAsyncCore[TState](Func`5 writeFunc, TState state)
2022-10-14T15:05:02.425 [Information] at Microsoft.Azure.Functions.Worker.GrpcWorker.SendStartStreamMessageAsync(IClientStreamWriter`1 requestStream) in D:\a\1\s\src\DotNetWorker.Grpc\GrpcWorker.cs:line 84
2022-10-14T15:05:02.426 [Information] at Microsoft.Azure.Functions.Worker.GrpcWorker.StartAsync(CancellationToken token) in D:\a\1\s\src\DotNetWorker.Grpc\GrpcWorker.cs:line 61
2022-10-14T15:05:02.426 [Information] at Microsoft.Azure.Functions.Worker.WorkerHostedService.StartAsync(CancellationToken cancellationToken) in D:\a\1\s\src\DotNetWorker.Core\WorkerHostedService.cs:line 25
2022-10-14T15:05:02.426 [Information] at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
2022-10-14T15:05:02.426 [Information] at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
2022-10-14T15:05:02.426 [Information] at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
2022-10-14T15:05:02.426 [Information] at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
2022-10-14T15:05:02.426 [Information] at MyCompany.MyApp.Api.Program.Main() in /home/vsts/work/1/s/src/Api/Program.cs:line 14
2022-10-14T15:05:02.681 [Debug] Handling WorkerErrorEvent for runtime:dotnet-isolated, workerId:dotnet-isolated. Failed with: Microsoft.Azure.WebJobs.Script.Workers.WorkerProcessExitException: dotnet exited with code 134 (0x86)
---> System.Exception: Unhandled exception. System.IO.IOException: The request was aborted., ---> System.Net.Http.Http2ConnectionException: The HTTP/2 server sent invalid data on the connection. HTTP/2 error code 'PROTOCOL_ERROR' (0x1)., at System.Net.Http.Http2Connection.ThrowProtocolError(Http2ProtocolErrorCode errorCode)
--- End of inner exception stack trace ---
2022-10-14T15:05:02.681 [Debug] Attempting to dispose webhost or jobhost channel for workerId: '6778e415-98a9-4167-8bf6-582416320e64', runtime: 'dotnet-isolated'
2022-10-14T15:05:02.681 [Debug] Disposing language worker channel with id:6778e415-98a9-4167-8bf6-582416320e64

什么会导致这种行为?我们尝试使用最新的.NET Framework。在此环境中还配置了自定义 DNS 服务器和路由表,但我们利用与所有其他专用端点配置相同的基础设施,这些基础设施可以正常工作。

最佳答案

我可以通过从 ConfigureAppConfiguration() 中删除 .AddEnvironmentVariables() 来解决问题

关于.net - 为 Azure Function App 启用 VNet 集成时出现 "Http2ConnectionException: HTTP/2 error code ' PROTOCOL_ERROR ' (0x1)"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74075905/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com