Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/296.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# CrystalQuartz作为windows服务运行时不工作_C#_Windows Services_Console Application_Scheduler_Quartz.net - Fatal编程技术网

C# CrystalQuartz作为windows服务运行时不工作

C# CrystalQuartz作为windows服务运行时不工作,c#,windows-services,console-application,scheduler,quartz.net,C#,Windows Services,Console Application,Scheduler,Quartz.net,我在quartz调度程序项目中添加了crystal quartz以显示仪表板()。 当我作为控制台应用程序运行应用程序时,下面的代码工作正常。但当我们将它作为windows服务部署在同一台机器上时,它就不起作用了。它甚至不会在事件记录器中抛出任何异常或日志 IScheduler scheduler = SetupScheduler(); Action<IAppBuilder> startup = app => {

我在quartz调度程序项目中添加了crystal quartz以显示仪表板()。 当我作为控制台应用程序运行应用程序时,下面的代码工作正常。但当我们将它作为windows服务部署在同一台机器上时,它就不起作用了。它甚至不会在事件记录器中抛出任何异常或日志

IScheduler scheduler = SetupScheduler();
                Action<IAppBuilder> startup = app => 
                {
                    app.UseCrystalQuartz(scheduler);
                };

                Console.WriteLine("Starting self-hosted server...");
                using (WebApp.Start("http://localhost:9000/", startup))
                {
                    Console.WriteLine("Server is started");
                    Console.WriteLine();
                    Console.WriteLine("Check http://localhost:9000/quartz to see jobs information");
                    Console.WriteLine();

                    Console.WriteLine("Starting scheduler...");
                    scheduler.Start();

                    Console.WriteLine("Scheduler is started");
                    Console.WriteLine();
                    Console.WriteLine("Press [ENTER] to close");     
                    Console.ReadLine();     
                }

                Console.WriteLine("Shutting down...");
                scheduler.Shutdown(waitForJobsToComplete: true);
                Console.WriteLine("Scheduler has been stopped");
isScheduler scheduler=SetupScheduler();
动作启动=应用=>
{
应用程序UseCrystalQuartz(调度程序);
};
WriteLine(“启动自托管服务器…”);
使用(WebApp.Start(“http://localhost:9000/“,启动)
{
Console.WriteLine(“服务器已启动”);
Console.WriteLine();
控制台。WriteLine(“检查http://localhost:9000/quartz 查看就业信息”);
Console.WriteLine();
Console.WriteLine(“启动计划程序…”);
scheduler.Start();
Console.WriteLine(“调度程序已启动”);
Console.WriteLine();
Console.WriteLine(“按[ENTER]关闭”);
Console.ReadLine();
}
控制台。WriteLine(“正在关闭…”);
scheduler.Shutdown(waitForJobsToComplete:true);
Console.WriteLine(“调度程序已停止”);

当我们将应用程序部署为windows服务时,在浏览器中打开链接“无法访问此站点”时,我遇到以下错误。但当我们将它作为控制台运行时,它工作正常。

最后,我将console.readline替换为下面的代码,从而解决了这个问题

System.Threading.ManualResetEvent ojbManualResetEvent = new System.Threading.ManualResetEvent(false);
                ojbManualResetEvent.WaitOne();

作为控制台运行和作为windows服务运行有什么区别吗?