2009-09-28 119 views
1

我試圖遠程連接到Quartz調度程序,所以我可以得到計劃運行的作業列表。在服務器應用程序,我用下面的代碼:遠程連接到Quartz Scheduler

NameValueCollection properties = new NameValueCollection(); 
    properties.Add("quartz.scheduler.instanceName", "OlScheduler"); 
    properties.Add("quartz.scheduler.instanceId", "Ol"); 
    properties.Add("quartz.threadPool.type", "Quartz.Simpl.SimpleThreadPool, Quartz"); 
    properties.Add("quartz.threadPool.threadCount", "5"); 
    properties.Add("quartz.threadPool.threadPriority", "Normal"); 
    properties.Add("quartz.scheduler.registryPort", "1099"); 
    properties.Add("quartz.scheduler.rmi.export", "true"); 
    properties.Add("quartz.scheduler.rmi.registryHost", "localhost"); 
    properties.Add("quartz.scheduler.rmi.registryPort", "1099"); 
    ISchedulerFactory sf = new StdSchedulerFactory(properties); 
    IScheduler sched = sf.GetScheduler(); 

和安裝並運行它作爲一個服務,然後從另一個應用程序,我用遠程連接到它:

properties["quartz.scheduler.instanceName"] = "RemoteClient"; 
    properties["quartz.threadPool.type"] = "Quartz.Simpl.SimpleThreadPool, Quartz"; 
    properties["quartz.threadPool.threadCount"] = "5"; 
    properties["quartz.threadPool.threadPriority"] = "Normal"; 
    properties["quartz.scheduler.proxy"] = "true"; 
    properties["quartz.scheduler.proxy.address"] = "http://170.20.20.17:1099/OIService"; 
    IScheduler sched = new StdSchedulerFactory(properties).GetScheduler(); 

,我得到的錯誤是: 「無法連接到遠程服務器」和「無法連接,因爲目標機器主動拒絕它172.22.22.17:1099」 我錯過了什麼?我正在使用Quartz.net版本1.1和RamJobStore,並且我的防火牆已關閉。 我認爲這是我使用錯誤的端口。任何幫助表示讚賞

回答

3

免責聲明:我不知道什麼關於Quartz Scheduler! :)

但是,如果你懷疑你可能有錯誤的端口號,如果您可以登錄到遠程服務器,並在命令行

netstat -b 

這將打印出正在使用的端口上運行按流程。希望這將允許您驗證端口號。

如果端口號是正確的,但你仍然無法與遠程服務器通信,你可以嘗試幾件事情:

  • 從命令行運行ping.exe [xxx.xxx.xxx.xxx],看看遠程服務器響應(* )
  • 驗證遠程服務器上的防火牆具有Quartz調度過程
  • 嘗試運行tracert [xxx.xxx.xxx.xxx]看到,如果你有兩個服務器之間的路由異常

(*)這並不總是確定的,因爲遠程服務器或中間的網絡硬件可能被配置爲不響應。