2011-04-26 29 views
0

虽然我几乎是Ruby on Rails的新手,但我的任务是调试Rails应用程序,而那个不在身边的人写道。该应用程序使用在manchine运行:无法获取Mongrel_Service Gem以启动Mongrel作为Windows服务

•Windows XP专业版

•Apache 2.2的

•Rails的2.3.8

•杂种(1.1.5 x86架构的mingw32)

•mongrel_service(0.3.4 i386-mswin32)

我从服务器复制了应用程序,并在我的个人计算机上对它进行了一些调试。我只在个人计算机上设置了一个Git存储库,并将其克隆回服务器。一切似乎都很好,除了mongrel_service不再工作。每次尝试从Windows“服务”工具启动服务时,都会出现此错误: 本地计算机上的MYAPP_Mongrel_As_Service服务已启动,然后停止。一些服务自动停止,如果他们没有工作要做,例如性能日志和警报服务 我试图删除Service:

C:\MyApp>mongrel_rails service::remove --name MYAPP_Mongrel_As_Service 
Stopping MYAPP_Mongrel_As_Service if running... 
MYAPP_Mongrel_As_Service service removed 

,并重新安装它:

C:\MyApp>mongrel_rails service::install --name MYAPP_Mongrel_As_Service -c "C:\MyApp" --port 3001 --env 
ironment production --address localhost --log "log\mongrel_as_service.log" --pid "tmp\pids\mongrel_a 
s_service.pid" 
MYAPP_Mongrel_As_Service service created. 

但是,没有不管我尝试了多少次,或者使用了什么选项,我都无法让服务运行。奇怪的是,我可以让杂种自己启动就好了。

C:\MyApp>mongrel_rails start -c c:\MyApp --port 3001 --environment production --address localhost -- 
g "c:\MyApp\log\mongrel_as_service.log" --pid "C:\MyApp\tmp\pids\mongrel_as_service.pid" 
** Starting Mongrel listening at localhost:3001 
** Starting Rails with production environment... 
** Rails loaded. 
** Loading any Rails specific GemPlugins 
** Signals ready. INT => stop (no restart). 
** Mongrel 1.1.5 available at localhost:3001 
** Use CTRL-C to stop. 

当我尝试将其作为服务启动时,它不起作用。我在这个主题上做了大量的搜索,但是我找不到任何解决这个问题的方法。它以前工作很奇怪,但现在不行。我的service :: install行一定有问题,因为我无法获得原始未经编辑的Rails应用程序来使用mongrel_as_service。

回答

1

我想通了。事实证明,mongrel_service的日志文件在我的文件中不存在。为了解决这个问题,我创建了一个空白的文本文件,并将其重命名为我的日志文件的名称。它像一个魅力。如果mongrel_service无法检测到它,它并不会自己创建日志文件,这很奇怪,但是哦。