使用.NET Core 2的Azure WebJob失败,并显示“无效的存储帐户”。 [英] Azure WebJobs using .NET Core 2 failing with "Invalid storage account"

查看:90
本文介绍了使用.NET Core 2的Azure WebJob失败,并显示“无效的存储帐户”。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

马特·罗伯茨(Matt Roberts)出色的循序渐进文章。NET Core 2中的Azure WebJobs(具有DI和配置)我创建了一个解决方案,该解决方案的部署没有问题(使用Visual Studio 2017),但是失败并出现无效的存储帐户异常:

Following Matt Roberts excellent step-by-step article Azure WebJobs in .NET Core 2 (with DI and configuration) I've created a solution that deploys without issue (using Visual Studio 2017), but fails with a "Invalid storage account" exception:

Unhandled Exception: System.InvalidOperationException: Invalid storage account 'mywebjobsstorage'. Please make sure your credentials are correct. ---> System.MissingMethodException: Method not found: 'System.Threading.Tasks.Task`1<Microsoft.WindowsAzure.Storage.Shared.Protocol.ServiceProperties> Microsoft.WindowsAzure.Storage.Blob.CloudBlobClient.GetServicePropertiesAsync(System.Threading.CancellationToken)'.

我可以看到必须删除AzureWebJobsDashboard和AzureWebJobsStorage环境变量,因为错误明确指出了连接字符串中使用的AccountName。

I can see that the AzureWebJobsDashboard and AzureWebJobsStorage environment variables must be getting picked up as the error explicitly names the AccountName used in the connection string.

我尝试使用存储连接字符串进行两种变体,结果相同:

I've tried two variations with the storage connection string with the same result:

DefaultEndpointsProtocol=https;AccountName=mywebjobsstorage;AccountKey=********

DefaultEndpointsProtocol=https;AccountName=mywebjobsstorage;AccountKey=********;EndpointSuffix=core.windows.net

任何想法可能是什么问题?

Any ideas what the issue might be?

以下是完整的异常日志,以防它包含任何其他线索,或者我被误导了:

Here's the full exception log in case it contains any other clues, or I'm being misdirected:

[03/29/2018 07:52:43 > d801c3: SYS INFO] Status changed to Initializing
[03/29/2018 07:52:48 > d801c3: SYS INFO] Run script 'run.cmd' with script host - 'WindowsScriptHost'
[03/29/2018 07:52:48 > d801c3: SYS INFO] Status changed to Running
[03/29/2018 07:52:48 > d801c3: INFO] 
[03/29/2018 07:52:48 > d801c3: INFO] D:\local\Temp\jobs\triggered\MyWebJobs\uoyrr1m3.5sq>dotnet MyWebJobs.dll 
[03/29/2018 07:52:50 > d801c3: ERR ] 
[03/29/2018 07:52:50 > d801c3: ERR ] Unhandled Exception: System.InvalidOperationException: Invalid storage account 'mywebjobsstorage'. Please make sure your credentials are correct. ---> System.MissingMethodException: Method not found: 'System.Threading.Tasks.Task`1<Microsoft.WindowsAzure.Storage.Shared.Protocol.ServiceProperties> Microsoft.WindowsAzure.Storage.Blob.CloudBlobClient.GetServicePropertiesAsync(System.Threading.CancellationToken)'.
[03/29/2018 07:52:50 > d801c3: ERR ]    at Microsoft.Azure.WebJobs.Host.Storage.Blob.StorageBlobClient.GetServicePropertiesAsync(CancellationToken cancellationToken)
[03/29/2018 07:52:50 > d801c3: ERR ]    at Microsoft.Azure.WebJobs.Host.Executors.DefaultStorageCredentialsValidator.<ValidateCredentialsAsyncCore>d__1.MoveNext()
[03/29/2018 07:52:50 > d801c3: ERR ]    --- End of inner exception stack trace ---
[03/29/2018 07:52:50 > d801c3: ERR ]    at Microsoft.Azure.WebJobs.Host.Executors.DefaultStorageCredentialsValidator.<ValidateCredentialsAsyncCore>d__1.MoveNext()
[03/29/2018 07:52:50 > d801c3: ERR ] --- End of stack trace from previous location where exception was thrown ---
[03/29/2018 07:52:50 > d801c3: ERR ]    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
[03/29/2018 07:52:50 > d801c3: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
[03/29/2018 07:52:50 > d801c3: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[03/29/2018 07:52:50 > d801c3: ERR ]    at Microsoft.Azure.WebJobs.Host.Executors.DefaultStorageCredentialsValidator.<ValidateCredentialsAsync>d__0.MoveNext()
[03/29/2018 07:52:50 > d801c3: ERR ] --- End of stack trace from previous location where exception was thrown ---
[03/29/2018 07:52:50 > d801c3: ERR ]    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
[03/29/2018 07:52:50 > d801c3: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
[03/29/2018 07:52:50 > d801c3: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[03/29/2018 07:52:50 > d801c3: ERR ]    at Microsoft.Azure.WebJobs.Host.Executors.DefaultStorageAccountProvider.<CreateAndValidateAccountAsync>d__24.MoveNext()
[03/29/2018 07:52:50 > d801c3: ERR ] --- End of stack trace from previous location where exception was thrown ---
[03/29/2018 07:52:51 > d801c3: ERR ]    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
[03/29/2018 07:52:51 > d801c3: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
[03/29/2018 07:52:51 > d801c3: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[03/29/2018 07:52:51 > d801c3: ERR ]    at Microsoft.Azure.WebJobs.Host.Executors.DefaultStorageAccountProvider.<TryGetAccountAsync>d__25.MoveNext()
[03/29/2018 07:52:51 > d801c3: ERR ] --- End of stack trace from previous location where exception was thrown ---
[03/29/2018 07:52:51 > d801c3: ERR ]    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
[03/29/2018 07:52:51 > d801c3: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
[03/29/2018 07:52:51 > d801c3: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[03/29/2018 07:52:51 > d801c3: ERR ]    at Microsoft.Azure.WebJobs.Host.Executors.JobHostConfigurationExtensions.<CreateJobHostContextAsync>d__1.MoveNext()
[03/29/2018 07:52:51 > d801c3: ERR ] --- End of stack trace from previous location where exception was thrown ---
[03/29/2018 07:52:51 > d801c3: ERR ]    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
[03/29/2018 07:52:51 > d801c3: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
[03/29/2018 07:52:51 > d801c3: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[03/29/2018 07:52:51 > d801c3: ERR ]    at Microsoft.Azure.WebJobs.JobHost.<InitializeHostAsync>d__44.MoveNext()
[03/29/2018 07:52:51 > d801c3: ERR ] --- End of stack trace from previous location where exception was thrown ---
[03/29/2018 07:52:51 > d801c3: ERR ]    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
[03/29/2018 07:52:51 > d801c3: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
[03/29/2018 07:52:51 > d801c3: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[03/29/2018 07:52:51 > d801c3: ERR ]    at Microsoft.Azure.WebJobs.JobHost.<StartAsyncCore>d__25.MoveNext()
[03/29/2018 07:52:51 > d801c3: ERR ] --- End of stack trace from previous location where exception was thrown ---
[03/29/2018 07:52:51 > d801c3: ERR ]    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
[03/29/2018 07:52:51 > d801c3: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
[03/29/2018 07:52:51 > d801c3: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[03/29/2018 07:52:51 > d801c3: ERR ]    at Microsoft.Azure.WebJobs.JobHost.Start()
[03/29/2018 07:52:51 > d801c3: ERR ]    at Microsoft.Azure.WebJobs.JobHost.RunAndBlock()
[03/29/2018 07:52:51 > d801c3: ERR ]    at MyWebJobs.Program.Main(String[] args) in C:\!Projects\SomeProject\src\MyWebJobs\Program.cs:line 30
[03/29/2018 07:52:51 > d801c3: SYS INFO] Status changed to Failed
[03/29/2018 07:52:51 > d801c3: SYS ERR ] Job failed due to exit code -532462766


推荐答案

在这些NuGet软件包中似乎都存在一个错误:

It looks like there was either a bug in either of these NuGet packages:


  • Microsoft.Azure.WebJobs

  • Microsoft.Azure.WebJobs.Extensions

我正在使用这些软件包的v2.2.0,但它们似乎具有一个错误。将这些交换为NuGet软件包的v3 beta预发行版本,无需任何代码更改即可解决此问题。

I was using v2.2.0 of these packages, but they appear to have a bug. Swapping these for v3 beta pre-releases of the NuGet packages without any code changes resolved the issue.

更新

.NET Core仅支持v3 +- https://github.com/Azure/azure-webjobs-sdk/issues/1649#issuecomment-377633805

Only v3+ is supported on .NET Core - https://github.com/Azure/azure-webjobs-sdk/issues/1649#issuecomment-377633805

这篇关于使用.NET Core 2的Azure WebJob失败,并显示“无效的存储帐户”。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆