本文介绍了Azure WebJobs NuGet软件包错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有人在Visual Studio模板上的Azure WebJobs Queue示例上遇到运行错误.

我更新了NuGet管理器上的所有软件包后,该示例开始运行.

这是错误消息:

System.InvalidOperationException
  HResult=0x80131509
  Message=Microsoft.WindowsAzure.Storage is deployed incorrectly. Are you missing a Table Service assembly (Microsoft.Data.Services.Client, Microsoft.Data.OData or Microsoft.Data.Edm) or a related binding redirect?
  Source=Microsoft.Azure.WebJobs.Host
  StackTrace:
   at Microsoft.Azure.WebJobs.Host.AzureStorageDeploymentValidator.Validate()
   at Microsoft.Azure.WebJobs.Host.Executors.JobHostConfigurationExtensions.CreateStaticServices(JobHostConfiguration config)
   at Microsoft.Azure.WebJobs.JobHost.InitializeServices()
   at Microsoft.Azure.WebJobs.JobHost.<InitializeHostAsync>d__44.MoveNext()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.WebJobs.JobHost.<StartAsyncCore>d__25.MoveNext()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.WebJobs.JobHost.Start()
   at Microsoft.Azure.WebJobs.JobHost.RunAndBlock()
   at QueueSample.Program.Main() in C:\Users\adity\Documents\Visual Studio 2017\Projects\AzureQueueStorage\QueueSample\Program.cs:line 28

Inner Exception 1:
TypeLoadException: Could not load type 'Microsoft.WindowsAzure.Storage.Table.DataServices.TableServiceContext' from assembly 'Microsoft.WindowsAzure.Storage, Version=9.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

这是已安装软件包的列表:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Microsoft.Azure.KeyVault.Core" version="2.0.4" targetFramework="net461" />
  <package id="Microsoft.Azure.WebJobs" version="2.1.0" targetFramework="net461" />
  <package id="Microsoft.Azure.WebJobs.Core" version="2.1.0" targetFramework="net461" />
  <package id="Microsoft.Data.Edm" version="5.8.3" targetFramework="net461" />
  <package id="Microsoft.Data.OData" version="5.8.3" targetFramework="net461" />
  <package id="Microsoft.Data.Services.Client" version="5.8.3" targetFramework="net461" />
  <package id="Microsoft.Extensions.Logging.Abstractions" version="2.0.0" targetFramework="net461" />
  <package id="Microsoft.NETCore.Platforms" version="2.0.1" targetFramework="net461" />
  <package id="Microsoft.Win32.Primitives" version="4.3.0" targetFramework="net461" />
  <package id="Microsoft.WindowsAzure.ConfigurationManager" version="3.2.3" targetFramework="net461" />
  <package id="NETStandard.Library" version="2.0.1" targetFramework="net461" />
  <package id="Newtonsoft.Json" version="11.0.1" targetFramework="net461" />
  <package id="System.AppContext" version="4.3.0" targetFramework="net461" />
  <package id="System.Collections" version="4.3.0" targetFramework="net461" />
  <package id="System.Collections.Concurrent" version="4.3.0" targetFramework="net461" />
  <package id="System.Console" version="4.3.0" targetFramework="net461" />
  <package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="net461" />
  <package id="System.Diagnostics.DiagnosticSource" version="4.4.1" targetFramework="net461" />
  <package id="System.Diagnostics.Tools" version="4.3.0" targetFramework="net461" />
  <package id="System.Diagnostics.Tracing" version="4.3.0" targetFramework="net461" />
  <package id="System.Globalization" version="4.3.0" targetFramework="net461" />
  <package id="System.Globalization.Calendars" version="4.3.0" targetFramework="net461" />
  <package id="System.IO" version="4.3.0" targetFramework="net461" />
  <package id="System.IO.Compression" version="4.3.0" targetFramework="net461" />
  <package id="System.IO.Compression.ZipFile" version="4.3.0" targetFramework="net461" />
  <package id="System.IO.FileSystem" version="4.3.0" targetFramework="net461" />
  <package id="System.IO.FileSystem.Primitives" version="4.3.0" targetFramework="net461" />
  <package id="System.Linq" version="4.3.0" targetFramework="net461" />
  <package id="System.Linq.Expressions" version="4.3.0" targetFramework="net461" />
  <package id="System.Net.Http" version="4.3.3" targetFramework="net461" />
  <package id="System.Net.Primitives" version="4.3.0" targetFramework="net461" />
  <package id="System.Net.Sockets" version="4.3.0" targetFramework="net461" />
  <package id="System.ObjectModel" version="4.3.0" targetFramework="net461" />
  <package id="System.Reflection" version="4.3.0" targetFramework="net461" />
  <package id="System.Reflection.Extensions" version="4.3.0" targetFramework="net461" />
  <package id="System.Reflection.Primitives" version="4.3.0" targetFramework="net461" />
  <package id="System.Resources.ResourceManager" version="4.3.0" targetFramework="net461" />
  <package id="System.Runtime" version="4.3.0" targetFramework="net461" />
  <package id="System.Runtime.Extensions" version="4.3.0" targetFramework="net461" />
  <package id="System.Runtime.Handles" version="4.3.0" targetFramework="net461" />
  <package id="System.Runtime.InteropServices" version="4.3.0" targetFramework="net461" />
  <package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net461" />
  <package id="System.Runtime.Numerics" version="4.3.0" targetFramework="net461" />
  <package id="System.Security.Cryptography.Algorithms" version="4.3.1" targetFramework="net461" />
  <package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net461" />
  <package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net461" />
  <package id="System.Security.Cryptography.X509Certificates" version="4.3.2" targetFramework="net461" />
  <package id="System.Spatial" version="5.8.3" targetFramework="net461" />
  <package id="System.Text.Encoding" version="4.3.0" targetFramework="net461" />
  <package id="System.Text.Encoding.Extensions" version="4.3.0" targetFramework="net461" />
  <package id="System.Text.RegularExpressions" version="4.3.0" targetFramework="net461" />
  <package id="System.Threading" version="4.3.0" targetFramework="net461" />
  <package id="System.Threading.Tasks" version="4.3.0" targetFramework="net461" />
  <package id="System.Threading.Timer" version="4.3.0" targetFramework="net461" />
  <package id="System.Xml.ReaderWriter" version="4.3.1" targetFramework="net461" />
  <package id="System.Xml.XDocument" version="4.3.0" targetFramework="net461" />
  <package id="WindowsAzure.Storage" version="9.1.0" targetFramework="net461" />
</packages>

当我使用默认模板和软件包时,它正在正常运行.更新了NuGet程序包后,它正在运行类似上面的错误.

谢谢

解决方案

根据您的错误消息,我认为问题可能与兼容性有关.

TableServiceContext自4.0版以来已被弃用,并在9.0版中作为删除OData依赖项的一部分进行了删除.最好将兼容版本用于软件包(例如WindowsAzure.Storage 8.7.0).有关此问题的更多详细信息,您可以阅读文章./p>

I would like to know if someone has experienced running error on Azure WebJobs Queue sample on Visual Studio templates.

The sample running to issue after I updated all the packages on NuGet manager.

This is the error message:

System.InvalidOperationException
  HResult=0x80131509
  Message=Microsoft.WindowsAzure.Storage is deployed incorrectly. Are you missing a Table Service assembly (Microsoft.Data.Services.Client, Microsoft.Data.OData or Microsoft.Data.Edm) or a related binding redirect?
  Source=Microsoft.Azure.WebJobs.Host
  StackTrace:
   at Microsoft.Azure.WebJobs.Host.AzureStorageDeploymentValidator.Validate()
   at Microsoft.Azure.WebJobs.Host.Executors.JobHostConfigurationExtensions.CreateStaticServices(JobHostConfiguration config)
   at Microsoft.Azure.WebJobs.JobHost.InitializeServices()
   at Microsoft.Azure.WebJobs.JobHost.<InitializeHostAsync>d__44.MoveNext()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.WebJobs.JobHost.<StartAsyncCore>d__25.MoveNext()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.WebJobs.JobHost.Start()
   at Microsoft.Azure.WebJobs.JobHost.RunAndBlock()
   at QueueSample.Program.Main() in C:\Users\adity\Documents\Visual Studio 2017\Projects\AzureQueueStorage\QueueSample\Program.cs:line 28

Inner Exception 1:
TypeLoadException: Could not load type 'Microsoft.WindowsAzure.Storage.Table.DataServices.TableServiceContext' from assembly 'Microsoft.WindowsAzure.Storage, Version=9.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

This is the list of installed packages:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Microsoft.Azure.KeyVault.Core" version="2.0.4" targetFramework="net461" />
  <package id="Microsoft.Azure.WebJobs" version="2.1.0" targetFramework="net461" />
  <package id="Microsoft.Azure.WebJobs.Core" version="2.1.0" targetFramework="net461" />
  <package id="Microsoft.Data.Edm" version="5.8.3" targetFramework="net461" />
  <package id="Microsoft.Data.OData" version="5.8.3" targetFramework="net461" />
  <package id="Microsoft.Data.Services.Client" version="5.8.3" targetFramework="net461" />
  <package id="Microsoft.Extensions.Logging.Abstractions" version="2.0.0" targetFramework="net461" />
  <package id="Microsoft.NETCore.Platforms" version="2.0.1" targetFramework="net461" />
  <package id="Microsoft.Win32.Primitives" version="4.3.0" targetFramework="net461" />
  <package id="Microsoft.WindowsAzure.ConfigurationManager" version="3.2.3" targetFramework="net461" />
  <package id="NETStandard.Library" version="2.0.1" targetFramework="net461" />
  <package id="Newtonsoft.Json" version="11.0.1" targetFramework="net461" />
  <package id="System.AppContext" version="4.3.0" targetFramework="net461" />
  <package id="System.Collections" version="4.3.0" targetFramework="net461" />
  <package id="System.Collections.Concurrent" version="4.3.0" targetFramework="net461" />
  <package id="System.Console" version="4.3.0" targetFramework="net461" />
  <package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="net461" />
  <package id="System.Diagnostics.DiagnosticSource" version="4.4.1" targetFramework="net461" />
  <package id="System.Diagnostics.Tools" version="4.3.0" targetFramework="net461" />
  <package id="System.Diagnostics.Tracing" version="4.3.0" targetFramework="net461" />
  <package id="System.Globalization" version="4.3.0" targetFramework="net461" />
  <package id="System.Globalization.Calendars" version="4.3.0" targetFramework="net461" />
  <package id="System.IO" version="4.3.0" targetFramework="net461" />
  <package id="System.IO.Compression" version="4.3.0" targetFramework="net461" />
  <package id="System.IO.Compression.ZipFile" version="4.3.0" targetFramework="net461" />
  <package id="System.IO.FileSystem" version="4.3.0" targetFramework="net461" />
  <package id="System.IO.FileSystem.Primitives" version="4.3.0" targetFramework="net461" />
  <package id="System.Linq" version="4.3.0" targetFramework="net461" />
  <package id="System.Linq.Expressions" version="4.3.0" targetFramework="net461" />
  <package id="System.Net.Http" version="4.3.3" targetFramework="net461" />
  <package id="System.Net.Primitives" version="4.3.0" targetFramework="net461" />
  <package id="System.Net.Sockets" version="4.3.0" targetFramework="net461" />
  <package id="System.ObjectModel" version="4.3.0" targetFramework="net461" />
  <package id="System.Reflection" version="4.3.0" targetFramework="net461" />
  <package id="System.Reflection.Extensions" version="4.3.0" targetFramework="net461" />
  <package id="System.Reflection.Primitives" version="4.3.0" targetFramework="net461" />
  <package id="System.Resources.ResourceManager" version="4.3.0" targetFramework="net461" />
  <package id="System.Runtime" version="4.3.0" targetFramework="net461" />
  <package id="System.Runtime.Extensions" version="4.3.0" targetFramework="net461" />
  <package id="System.Runtime.Handles" version="4.3.0" targetFramework="net461" />
  <package id="System.Runtime.InteropServices" version="4.3.0" targetFramework="net461" />
  <package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net461" />
  <package id="System.Runtime.Numerics" version="4.3.0" targetFramework="net461" />
  <package id="System.Security.Cryptography.Algorithms" version="4.3.1" targetFramework="net461" />
  <package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net461" />
  <package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net461" />
  <package id="System.Security.Cryptography.X509Certificates" version="4.3.2" targetFramework="net461" />
  <package id="System.Spatial" version="5.8.3" targetFramework="net461" />
  <package id="System.Text.Encoding" version="4.3.0" targetFramework="net461" />
  <package id="System.Text.Encoding.Extensions" version="4.3.0" targetFramework="net461" />
  <package id="System.Text.RegularExpressions" version="4.3.0" targetFramework="net461" />
  <package id="System.Threading" version="4.3.0" targetFramework="net461" />
  <package id="System.Threading.Tasks" version="4.3.0" targetFramework="net461" />
  <package id="System.Threading.Timer" version="4.3.0" targetFramework="net461" />
  <package id="System.Xml.ReaderWriter" version="4.3.1" targetFramework="net461" />
  <package id="System.Xml.XDocument" version="4.3.0" targetFramework="net461" />
  <package id="WindowsAzure.Storage" version="9.1.0" targetFramework="net461" />
</packages>

When I using default templates and packages, it is running without error.After I have updated the NuGet packages, it is running error like above.

Thank You

解决方案

According to your error message, I suppose the issue may be related with the compatibility.

TableServiceContext has been deprecated since version 4.0 and was removed in version 9.0 as part of dropping OData dependencies. You'd better use the compatible version for packages(such as WindowsAzure.Storage 8.7.0). For more details about this issue, you could read this article.

这篇关于Azure WebJobs NuGet软件包错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 22:50