尝试使用
mongrel_rails start尝试在rails应用程序上启动ruby时,为什么会出现以下错误?
C:\RailsTest\cookbook2>mongrel_rails start ** WARNING: Win32 does not support daemon mode. ** Daemonized, any open files are closed. Look at log/mongrel.pid and log/mongr el.log for info. ** Starting Mongrel listening at 0.0.0.0:3000 c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../lib/mongrel/t cphack.rb:12:in `initialize_without_backlog': Only one usage of each socket addr ess (protocol/network address/port) is normally permitted. - bind(2) (Errno::EAD DRINUSE) from c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../ lib/mongrel/tcphack.rb:12:in `initialize' from c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../ lib/mongrel.rb:93:in `new' from c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../ lib/mongrel.rb:93:in `initialize' from c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../ lib/mongrel/configurator.rb:139:in `new' from c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../ lib/mongrel/configurator.rb:139:in `listener' from c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/mon grel_rails:99:in `cloaker_' from c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../ lib/mongrel/configurator.rb:50:in `call' from c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../ lib/mongrel/configurator.rb:50:in `initialize' from c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/mon grel_rails:84:in `new' from c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/mon grel_rails:84:in `run' from c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../ lib/mongrel/command.rb:212:in `run' from c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/mon grel_rails:281 from c:/ruby/bin/mongrel_rails:19:in `load' from c:/ruby/bin/mongrel_rails:19
答案 0 :(得分:2)
我自己不在windows上使用mongrel,但我猜这个错误相当于Linux的“使用中的端口”错误。您是否尝试将服务器绑定到其他已经在侦听的端口上?
答案 1 :(得分:2)
您已经有一个进程侦听端口3000(mongrel的默认端口)。
尝试:
mongrel_rails start -p 3001
并查看是否收到类似错误。
如果您尝试安装多个Rails应用程序,则需要将每个mongrel分配到一个单独的端口并相应地编辑apache conf。
如果你不想这样做,杀死所有mongrels的最直接方法是打开windows任务管理器并杀死所有'ruby'进程。
请注意,如果您将mongrel作为自动启动的服务安装
mongrel_rails install::service ...
... ruby进程将自动重新生成。在这种情况下,您必须通过Windows服务面板编辑流程属性。如果您需要更多信息,请告诉我。
答案 2 :(得分:0)
在Windows上,我找到了两种解决此问题的方法: