带有Microsoft.WindowsAzure.Storage.StorageException的Azure WebJobs FunctionIndexingException禁止403

时间:2018-07-12 18:41:09

标签: azure azure-storage azure-webjobs

当我尝试运行WebJob时,出现以下错误:

[07/12/2018 18:09:21 > 7351a7: ERR ] Unhandled Exception: Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexingException: Error indexing method 'Foo.Bar' ---> System.InvalidOperationException: Invalid storage account 'storage'. Please make sure your credentials are correct. ---> Microsoft.WindowsAzure.Storage.StorageException: The remote server returned an error: (403) Forbidden. ---> System.Net.WebException: The remote server returned an error: (403) Forbidden.
[07/12/2018 18:09:21 > 7351a7: ERR ]    at Microsoft.WindowsAzure.Storage.Shared.Protocol.HttpResponseParsers.ProcessExpectedStatusCodeNoException[T](HttpStatusCode expectedStatusCode, HttpStatusCode actualStatusCode, T retVal, StorageCommandBase`1 cmd, Exception ex)
[07/12/2018 18:09:21 > 7351a7: ERR ]    at Microsoft.WindowsAzure.Storage.Blob.CloudBlobClient.b__19(RESTCommand`1 cmd, HttpWebResponse resp, Exception ex, OperationContext ctx)
[07/12/2018 18:09:21 > 7351a7: ERR ]    at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.EndGetResponse[T](IAsyncResult getResponseResult)
[07/12/2018 18:09:21 > 7351a7: ERR ]    --- End of inner exception stack trace ---
[07/12/2018 18:09:21 > 7351a7: ERR ]    at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.EndExecuteAsync[T](IAsyncResult result)
[07/12/2018 18:09:21 > 7351a7: ERR ]    at Microsoft.WindowsAzure.Storage.Core.Util.AsyncExtensions.c__DisplayClass2`1.b__0(IAsyncResult ar)
[07/12/2018 18:09:21 > 7351a7: ERR ] --- End of stack trace from previous location where exception was thrown ---
[07/12/2018 18:09:21 > 7351a7: ERR ]    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
[07/12/2018 18:09:21 > 7351a7: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[07/12/2018 18:09:21 > 7351a7: ERR ]    at Microsoft.Azure.WebJobs.Host.Executors.DefaultStorageCredentialsValidator.d__1.MoveNext()
[07/12/2018 18:09:21 > 7351a7: ERR ]    --- End of inner exception stack trace ---
[07/12/2018 18:09:21 > 7351a7: ERR ]    at Microsoft.Azure.WebJobs.Host.Executors.DefaultStorageCredentialsValidator.d__1.MoveNext()
[07/12/2018 18:09:21 > 7351a7: ERR ] --- End of stack trace from previous location where exception was thrown ---
[07/12/2018 18:09:21 > 7351a7: ERR ]    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
[07/12/2018 18:09:21 > 7351a7: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[07/12/2018 18:09:21 > 7351a7: ERR ]    at Microsoft.Azure.WebJobs.Host.Executors.DefaultStorageCredentialsValidator.d__0.MoveNext()
[07/12/2018 18:09:21 > 7351a7: ERR ] --- End of stack trace from previous location where exception was thrown ---
[07/12/2018 18:09:21 > 7351a7: ERR ]    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
[07/12/2018 18:09:21 > 7351a7: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[07/12/2018 18:09:21 > 7351a7: ERR ]    at Microsoft.Azure.WebJobs.Host.Executors.DefaultStorageAccountProvider.d__24.MoveNext()
[07/12/2018 18:09:21 > 7351a7: ERR ] --- End of stack trace from previous location where exception was thrown ---
[07/12/2018 18:09:21 > 7351a7: ERR ]    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
[07/12/2018 18:09:21 > 7351a7: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[07/12/2018 18:09:21 > 7351a7: WARN] Reached maximum allowed output lines for this run, to see all of the job's logs you can enable website application diagnostics
[07/12/2018 18:09:21 > 7351a7: SYS ERR ] Job failed due to exit code -532462766
[07/12/2018 18:09:21 > 7351a7: SYS INFO] Process went down, waiting for 60 seconds

我已100%验证了我的存储帐户凭据正确。

当我尝试手动连接到存储帐户并调用CreateifNotExist时,我得到:

[07/12/2018 18:11:46 > 7351a7: INFO]       Microsoft.WindowsAzure.Storage.StorageException: The remote server returned an error: (403) Forbidden. ---> System.Net.WebException: The remote server returned an error: (403) Forbidden.
[07/12/2018 18:11:46 > 7351a7: INFO]          at System.Net.HttpWebRequest.GetResponse()
[07/12/2018 18:11:46 > 7351a7: INFO]          at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext)
[07/12/2018 18:11:46 > 7351a7: INFO]          --- End of inner exception stack trace ---
[07/12/2018 18:11:46 > 7351a7: INFO]          at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext)
[07/12/2018 18:11:46 > 7351a7: INFO]          at Microsoft.WindowsAzure.Storage.Queue.CloudQueue.CreateIfNotExists(QueueRequestOptions options, OperationContext operationContext)

Microsoft.WindowsAzure.Storage.StorageExtendedErrorInformation转储有关该异常的其他信息后,我看到:

AuthenticationErrorDetail:The MAC signature found in the HTTP request 'CUVqVMvvWecPsnTEynjocGpq6TkBmkpJsVL6hr2jkKQ=' is not the same as any computed signature. Server used following string to sign: 'PUT

1 个答案:

答案 0 :(得分:0)

请参阅以下GitHub问题,其中ApplicationInsights可能会干扰您对存储REST API的HTTP请求:

https://github.com/Azure/azure-storage-net/issues/490

请确保您的applicationinsights.config文件中包含以下内容:

    <Add Type="Microsoft.ApplicationInsights.DependencyCollector.DependencyTrackingTelemetryModule, Microsoft.AI.DependencyCollector">
      <ExcludeComponentCorrelationHttpHeadersOnDomains>
        <!-- 
        Requests to the following hostnames will not be modified by adding correlation headers.         
        Add entries here to exclude additional hostnames.
        NOTE: this configuration will be lost upon NuGet upgrade.
        -->
        <Add>core.windows.net</Add>
        <Add>core.chinacloudapi.cn</Add>
        <Add>core.cloudapi.de</Add>
        <Add>core.usgovcloudapi.net</Add>
        <Add>localhost</Add>
        <Add>127.0.0.1</Add>
      </ExcludeComponentCorrelationHttpHeadersOnDomains>
      <IncludeDiagnosticSourceActivities>
        <Add>Microsoft.Azure.EventHubs</Add>
        <Add>Microsoft.Azure.ServiceBus</Add>
      </IncludeDiagnosticSourceActivities>
    </Add>