使用.NET Core 2的Azure WebJob失败,并显示“无效的存储帐户”。

编程入门 行业动态 更新时间:2024-10-19 17:33:26
本文介绍了使用.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

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

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 +- github/Azure/azure-webjobs-sdk/issues/1649#issuecomment-377633805

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

更多推荐

使用.NET Core 2的Azure WebJob失败,并显示“无效的存储帐户”。

本文发布于:2023-11-14 04:24:01,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1586207.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:帐户   Core   NET   WebJob   Azure

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!