简体   繁体   中英

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.

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)

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.

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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