2017-07-06 23 views
0

Quartzを使用してスケジューリングを管理する、継続的に動作するWebジョブとしてコンソールアプリケーションを公開しました。Quartzで失敗したAzure Webジョブ

ファイルをローカルで実行すると、Quartzが正常に動作します。

ファイルをWebジョブとして実行すると、スケジュールどおりに実行されていることがわかります。

私は、Webジョブのログを見るとしかし、私はこのようなエラーを参照してください。

[07/06/2017 09:48:59 > dd118a: ERR ] Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Quartz, Version=2.5.0.0, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4' or one of its dependencies. The system cannot find the file specified. 

私はここに他の、同様の質問を見ているが、一般的に、これは自分のアセンブリのミスマッチの問題を持つ人々を必要としますローカルマシン。

このエラーが重大であるかどうかを確認するにはどうすればよいですか?

提案?

答えて

0

Quartz.NETライブラリ(v2.5.0)を使用して次のサンプルコードでテストします。ローカルでも、WebJobとしてもうまく動作します。

using Quartz; 
using Quartz.Impl; 
using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using System.Threading; 
using System.Threading.Tasks; 

namespace QuartzTest 
{ 
    class Program 
    { 
     static void Main(string[] args) 
     { 
      try 
      { 
       Common.Logging.LogManager.Adapter = new Common.Logging.Simple.ConsoleOutLoggerFactoryAdapter { Level = Common.Logging.LogLevel.Info }; 

       // Grab the Scheduler instance from the Factory 
       IScheduler scheduler = StdSchedulerFactory.GetDefaultScheduler(); 

       // and start it off 
       scheduler.Start(); 

       // define the job and tie it to our HelloJob class 
       IJobDetail job = JobBuilder.Create<HelloJob>() 
        .WithIdentity("job1", "group1") 
        .Build(); 

       // Trigger the job to run now, and then repeat every 10 seconds 
       ITrigger trigger = TriggerBuilder.Create() 
        .WithIdentity("trigger1", "group1") 
        .StartNow() 
        .WithSimpleSchedule(x => x 
         .WithIntervalInSeconds(10) 
         .RepeatForever()) 
        .Build(); 

       // Tell quartz to schedule the job using our trigger 
       scheduler.ScheduleJob(job, trigger); 

       // some sleep to show what's happening 
       Thread.Sleep(TimeSpan.FromSeconds(60)); 

       // and last shut down the scheduler when you are ready to close your program 
       scheduler.Shutdown(); 
      } 
      catch (SchedulerException se) 
      { 
       Console.WriteLine(se); 
      } 

      //Console.WriteLine("Press any key to close the application"); 
      //Console.ReadKey(); 

     } 

     public class HelloJob : IJob 
     { 
      public void Execute(IJobExecutionContext context) 
      { 
       Console.WriteLine("Greetings from HelloJob!"); 
      } 
     } 

    } 
} 

<?xml version="1.0" encoding="utf-8"?> 
<packages> 
    <package id="Common.Logging" version="3.3.1" targetFramework="net452" /> 
    <package id="Common.Logging.Core" version="3.3.1" targetFramework="net452" /> 
    <package id="Microsoft.Web.WebJobs.Publish" version="1.0.12" targetFramework="net452" /> 
    <package id="Quartz" version="2.5.0" targetFramework="net452" /> 
</packages> 

WebJobsログ

enter image description here

は、ファイルまたはアセンブリをロードできませんでした

packages.config「クォーツ、バージョン= 2.5.0.0、文化=中立、なPublicKeyToken = f6b8c98a402cc8a4 'またはその依存関係の1つ。システムは、指定されたファイルを見つけることができません。

サイトのフォルダにアクセスし、石英とその依存関係ファイルがあることを確認するthe Kudu Consoleを使用してください(D:連続{ジョブ名} \ホーム\サイト\ \ wwwrootに\ App_Dataに\ジョブ)。また、あなたの仕事を削除してAzure Webアプリケーションに再デプロイしようとすることもできます。

enter image description here

また、Azure WebJob itself can be triggered on a scheduleは、可能ならば、あなたはそれを使用することができます。

関連する問題