首页 > 解决方案 > Azure WebJobs SDK 异常:运行应用程序时被禁止

问题描述

我有一个需要在 Mac (11.3.1) 上运行以进行开发的 .NET Core 应用程序。同一个应用程序在 Windows 上运行良好,除了操作系统之外,唯一的区别是在 Mac 上我必须使用Azurite进行存储仿真(在 Windows 上,仿真是使用Azure Storage emulator完成的)。

我们正在使用的库版本:

我对 Azure 工具的经验很少,据我所知,运行它所需的配置是通过正确的连接字符串集正确完成的。

我遇到的问题是当我通过运行应用程序时dotnet run出现以下错误:

Unhandled exception.Unhandled exception.Unhandled exception.   Microsoft.Azure.Storage.StorageException: Forbidden
   at Microsoft.Azure.Storage.Core.Executor.Executor.ExecuteAsync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext, CancellationToken token)
   at Microsoft.Azure.WebJobs.Host.Queues.Listeners.QueueListener.ExecuteAsync(CancellationToken cancellationToken) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Extensions.Storage\Queues\Listeners\QueueListener.cs:line 193
   at Microsoft.Azure.WebJobs.Host.Timers.TaskSeriesTimer.RunAsync(CancellationToken cancellationToken) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Timers\TaskSeriesTimer.cs:line 147
   at Microsoft.Azure.WebJobs.Host.Timers.WebJobsExceptionHandler.<>c__DisplayClass3_0.<OnUnhandledExceptionAsync>b__0() in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Timers\WebJobsExceptionHandler.cs:line 55
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()
Request Information
RequestID:
RequestDate:Wed, 12 May 2021 11:04:39 GMT
StatusMessage:Forbidden
ErrorCode:

在寻找解决方案时,我在 SO 上发现了这个问题,虽然错误消息非常相似,但我无法使用建议的解决方案解决问题。

谢谢。

标签: c#macosazureazure-storageazurite

解决方案


推荐阅读