Publish Azure Webjob with Schedule error

妖精的绣舞 提交于 2019-12-10 23:39:08

问题


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.

Here is the error I am getting below..

It looks like it cannot find the Microsoft.Web.WebJobs.Publish.Tasks.CreateScheduledWebJob when publishing.

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.

I have created new WebJob projects using different methods,

  1. Right click solution -> add new project -> Cloud -> Microsoft Azure WebJob
  2. Right click solution -> add new project -> Windows Desktop -> Console Application
  3. Right click Website -> Add -> New Azure Webjob Project

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".

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. 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)


回答1:


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. Adding the following lines to the App.config of the webjob project solved the publishing issue:

<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). The free plan supports apparently only a 1 day recurrence (time of writing).

Hopes this helps further.




回答2:


I added that in and tried to created a new Webjob by using the right click project and choosing add -> New Azure WebJob project and got the same




回答3:


Perhaps you can sidestep this entire problem and just use a TimerTrigger for scheduling instead? Make sure to deploy as a triggered WebJob.



来源:https://stackoverflow.com/questions/26438026/publish-azure-webjob-with-schedule-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!