简体   繁体   English

发布带有计划错误的Azure Webjob

[英]Publish Azure Webjob with Schedule error

I am having an issue with publishing a Webjob with a schedule from VS 2013. I can publish an "on demand" job no problems but I want it with a schedule. 我在发布具有VS 2013计划的Webjob时遇到问题。我可以发布“按需”作业,没有问题,但我希望使用计划表。

Here is the error I am getting below.. 这是我在下面遇到的错误。

It looks like it cannot find the Microsoft.Web.WebJobs.Publish.Tasks.CreateScheduledWebJob when publishing. 发布时似乎找不到Microsoft.Web.WebJobs.Publish.Tasks.CreateScheduledWebJob。

I have done everything to try sort it even updated VS2013 to version 3, added the Nuget Packages, Azure SDK, the publishing SDK, the Azure Scheduler Management Library, the Azure Service Management Library & the Azure Common Library. 我已尽一切努力尝试对它进行排序,甚至将VS2013更新至版本3,添加了Nuget程序包,Azure SDK,发布SDK,Azure Scheduler管理库,Azure服务管理库和Azure公共库。

I have created new WebJob projects using different methods, 我使用不同的方法创建了新的WebJob项目,

  1. Right click solution -> add new project -> Cloud -> Microsoft Azure WebJob 右键单击解决方案->添加新项目->云-> Microsoft Azure WebJob
  2. Right click solution -> add new project -> Windows Desktop -> Console Application 右键单击解决方案->添加新项目-> Windows桌面->控制台应用程序
  3. Right click Website -> Add -> New Azure Webjob Project 右键单击网站->添加->新Azure Webjob项目

C:\\Development\\dependencies\\Microsoft.Web.WebJobs.Publish.1.0.0\\tools\\webjobs.console.targets(80,5): Error MSB4061: The "Microsoft.Web.WebJobs.Publish.Tasks.CreateScheduledWebJob" task could not be instantiated from "C:\\Users\\Tony\\AppData\\Local\\assembly\\dl3\\XDNO1P6L.QON\\HEVOMEZ0.AYO\\587c592f\\a99a921c_5eeacf01\\Microsoft.Web.WebJobs.Publish.Tasks.dll". C:\\ Development \\ dependencies \\ Microsoft.Web.WebJobs.Publish.1.0.0 \\ tools \\ webjobs.console.targets(80,5):错误MSB4061:“ Microsoft.Web.WebJobs.Publish.Tasks.CreateScheduledWebJob”任务无法从“ C:\\ Users \\ Tony \\ AppData \\ Local \\ assembly \\ dl3 \\ XDNO1P6L.QON \\ HEVOMEZ0.AYO \\ 587c592f \\ a99a921c_5eeacf01 \\ Microsoft.Web.WebJobs.Publish.Tasks.dll”中实例化。

 System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.WindowsAzure.Management.Scheduler, Version=1.0.0.0, 

Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. 文化=中性,PublicKeyToken = 31bf3856ad364e35'或其依赖项之一。 The system cannot find the file specified. 该系统找不到指定的文件。 File name: 'Microsoft.WindowsAzure.Management.Scheduler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' at System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes) at System.Reflection.RuntimeAssembly.GetExportedTypes() at Microsoft.Build.Shared.TypeLoader.AssemblyInfoToLoadedTypes.ScanAssemblyForPublicTypes() at Microsoft.Build.Shared.TypeLoader.AssemblyInfoToLoadedTypes.GetLoadedTypeByTypeName(String typeName) at Microsoft.Build.Shared.TypeLoader.GetLoadedType(Object cacheLock, Object loadInfoToTypeLock, ConcurrentDictionary2 cache, String typeName, AssemblyLoadInfo assembly) at Microsoft.Build.CommandLine.OutOfProcTaskAppDomainWrapperBase.ExecuteTask(IBuildEngine oopTaskHostNode, String taskName, String taskLocation, String taskFile, Int32 taskLine, Int32 taskColumn, AppDomainSetup appDomainSetup, IDictionary2 taskParams) 文件名:System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly程序集,ObjectHandleOnStack retTypes)在System.Reflection.RuntimeAssembly(GetExported.GetExportedTypes,版本= 1.0.0.0,文化=中立,PublicKeyToken = 31bf3856ad364e35) )Microsoft.Build.Shared.TypeLoader.AssemblyInfoToLoadedTypes.ScanAssemblyForPublicTypes()处Microsoft.Build.Shared.TypeLoader.AssemblyInfoToLoadedTypes.ScanAssemblyForPublicTypes() ,位于Microsoft.Build.CommandLine.OutOfProcTaskAppDomainWrapperBase.ExecuteTask(IBuildEngine oopTaskHostNode,String taskName,String taskLocation,String taskFile,Int32 taskLine,Int32 taskColumn,AppDomainSetup,appDomainSetup,IDictionary2 taskParams)的String typeName,AssemblyLoadInfo程序集)

In my case the 'Microsoft.WindowsAzure.Management.Scheduler' version 3.0.0.0 was referenced in the webjob project but the log reported a missing version 1.0.0.0. 在我的案例中,webjob项目中引用了Microsoft.WindowsAzure.Management.Scheduler版本3.0.0.0,但是日志报告缺少版本1.0.0.0。 Adding the following lines to the App.config of the webjob project solved the publishing issue: 将以下行添加到webjob项目的App.config中解决了发布问题:

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <assemblyIdentity name="Microsoft.WindowsAzure.Management.Scheduler" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
  </dependentAssembly>
</assemblyBinding>
</runtime>

The section can be added somewhere within the tag. 该部分可以添加到标签内的某处。

Please allow me one additional note which is not related to your question. 请再给我一张与您的问题无关的纸条。 While publishing the scheduled webjob I learned that the available recurrence frequency depends on the website configuration. 发布预定的网络作业时,我了解到可用的重复频率取决于网站配置。 I was not able to use a recurrence frequency bellow 1 day with the free plan (hat to scale to standard for my schedule plan). 在免费计划下,我无法在1天后使用重复频率(要按照我的计划计划的标准进行调整)。 The free plan supports apparently only a 1 day recurrence (time of writing). 免费计划显然仅支持1天的重复(撰写本文的时间)。

Hopes this helps further. 希望这能进一步帮助。

我在其中添加了内容,并尝试通过使用右键单击项目并选择添加->新Azure WebJob项目来创建新的Webjob,并得到了相同的结果

Perhaps you can sidestep this entire problem and just use a TimerTrigger for scheduling instead? 也许您可以回避整个问题,而只使用TimerTrigger进行调度? Make sure to deploy as a triggered WebJob. 确保将其部署为触发的WebJob。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM