gpt4 book ai didi

c# - Azure 函数异常 - 将日志写入表存储时出错 : Microsoft. Azure.Cosmos.Table.StorageException

转载 作者:行者123 更新时间:2023-12-02 05:54:36 25 4
gpt4 key购买 nike

我有一个 Azure 函数,它与 Blob 存储通信以读取上次同步日期时间,然后基于此从 Cosmos 数据库中读取数据。

很少有交互可以正常工作,并且在某些情况下会随机抛出以下异常

"Error writing logs to table storage:Microsoft.Azure.Cosmos.Table.StorageException: An operation on asocket could not be performed because the system lacked sufficientbuffer space or because a queue was full. --->System.Net.Http.HttpRequestException: An operation on a socket couldnot be performed because the system lacked sufficient buffer space orbecause a queue was full. ---> System.Net.Sockets.SocketException(10055): An operation on a socket could not be performed because thesystem lacked sufficient buffer space or because a queue was full. atSystem.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port,CancellationToken cancellationToken) --- End of inner exception stacktrace --- at System.Net.Http.ConnectHelper.ConnectAsync(String host,Int32 port, CancellationToken cancellationToken) atSystem.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessagerequest, Boolean allowHttp2, CancellationToken cancellationToken) atSystem.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessagerequest, CancellationToken cancellationToken) atSystem.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessagerequest, CancellationToken cancellationToken) atSystem.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessagerequest, Boolean doRequestAuth, CancellationToken cancellationToken)at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessagerequest, CancellationToken cancellationToken) atSystem.Net.Http.DiagnosticsHandler.SendAsync(HttpRequestMessagerequest, CancellationToken cancellationToken) atSystem.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts) at Microsoft.Azure.Cosmos.Table.RestExecutor.TableCommand.Executor.ExecuteAsync[T](RESTCommand1cmd, IRetryPolicy policy, OperationContext operationContext,CancellationToken token) --- End of inner exception stack trace --- atMicrosoft.Azure.Cosmos.Table.RestExecutor.TableCommand.Executor.ExecuteAsync[T](RESTCommand1 cmd, IRetryPolicy policy, OperationContext operationContext, CancellationToken token) at Microsoft.Azure.WebJobs.Logging.Utility.SafeExecuteAsync(CloudTable table, TableBatchOperation batch) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Logging\Internal\Utility.cs:line 178 at Microsoft.Azure.WebJobs.Logging.Utility.WriteBatchAsync[T](ILogTableProvider logTableProvider, IEnumerable1 e1) inC:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Logging\Internal\Utility.cs:line268 atMicrosoft.Azure.WebJobs.Logging.LogWriter.FlushTimelineAggregateAsync(Booleanalways) inC:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Logging\Internal\LogWriter.cs:line265 at Microsoft.Azure.WebJobs.Logging.LogWriter.FlushCoreAsync() inC:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Logging\Internal\LogWriter.cs:line316 Request Information RequestID: RequestDate: StatusMessage:ErrorCode:"

有人可以告诉我如何修复它吗?

最佳答案

我刚刚从 v2 升级到 v3 的函数应用程序遇到了同样的问题。

正如您所注意到的,异常不是来自您的代码,而是来自 Microsoft.Azure.WebJobs.Logging 内部,无论您是什么,它都只是继续处理自己的事情正在做。它也只发生在本地,而不是在我部署的实例中。

基于the answer here我删除了AzureWebJobsDashboard从我的 local.settings.json 文件进行设置,错误已经消失。

Internally Functions uses Table Storage for logging if the AzureWebJobsDashboard app setting is set. It's recommended to use Application Insights for logging in production scenarios, so you can safely remove this and set the APPINSIGHTS_INSTRUMENTATIONKEY app setting instead.

看来我不需要为本地开发存储日志,而且我部署的函数都只设置了APPINSIGHTS_INSTRUMENTATIONKEY

关于c# - Azure 函数异常 - 将日志写入表存储时出错 : Microsoft. Azure.Cosmos.Table.StorageException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65684335/

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