Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.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
Ruby on rails 4 在Windows后台运行webrick服务器_Ruby On Rails 4_Background_Windows 7_Webrick - Fatal编程技术网

Ruby on rails 4 在Windows后台运行webrick服务器

Ruby on rails 4 在Windows后台运行webrick服务器,ruby-on-rails-4,background,windows-7,webrick,Ruby On Rails 4,Background,Windows 7,Webrick,我想在Windows上后台运行Webrick server,尝试了以下操作但没有成功: >rails s -d C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/activesupport-4.0.4/lib/active_support/values/time_zone.rb:283: warning: circular argument reference - now => Booting WEBrick => Rails 4.0.4 appli

我想在Windows上后台运行Webrick server,尝试了以下操作但没有成功:

>rails s -d
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/activesupport-4.0.4/lib/active_support/values/time_zone.rb:283: warning: circular argument reference - now
=> Booting WEBrick
=> Rails 4.0.4 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rack-1.5.5/lib/rack/server.rb:327:in `daemon': daemon() function is unimplemented on this machine (NotImplementedError)
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rack-1.5.5/lib/rack/server.rb:327:in `daemonize_app'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rack-1.5.5/lib/rack/server.rb:252:in `start'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.0.4/lib/rails/commands/server.rb:84:in `start'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.0.4/lib/rails/commands.rb:76:in `block in <top (required)>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.0.4/lib/rails/commands.rb:71:in `tap'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.0.4/lib/rails/commands.rb:71:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'
rails s-d C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/activesupport-4.0.4/lib/active\u support/values/timeu\u zone.rb:283:警告:循环参数引用-现在 =>启动WEBrick =>Rails 4.0.4应用程序在上开始开发http://0.0.0.0:3000 =>运行“rails服务器-h”以获得更多启动选项 C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rack-1.5.5/lib/rack/server.rb:327:“守护进程”中:守护进程()函数未在此计算机上实现(未实现错误) 来自C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rack-1.5.5/lib/rack/server.rb:327:in'daemonize_app' 来自C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rack-1.5.5/lib/rack/server.rb:252:in'start' 来自C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.0.4/lib/rails/commands/server.rb:84:in'start' 来自C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.0.4/lib/rails/commands.rb:76:in'block in' 来自C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.0.4/lib/rails/commands.rb:71:in'tap' 来自C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.0.4/lib/rails/commands.rb:71:in`' 从箱子/轨道:4:in“require” 从箱子/轨道:4:in`' 我如何解决这个问题

解决方案来自:

下载
service\u wrapper-0.1.0-win32.zip
并从
bin/
提取
service\u wrapper.exe
。我将其解压缩到
C:\service\u wrapper

接下来设置一个配置文件。我使用了hello示例并为我的应用程序修改了它,然后将其放在
C:\service\u wrapper
目录中

; Service section, it will be the only section read by service_wrapper
[service]

; Provide full path to executable to avoid issues when executable path was not
; added to system PATH.
executable = C:\Ruby192\bin\ruby.exe

; Provide there the arguments you will pass to executable from the command line
arguments = C:\railsapp\script\rails s -e production

; Which directory will be used when invoking executable.
; Provide a full path to the directory (not to a file)
directory = C:\railsapp

; Optionally specify a logfile where both STDOUT and STDERR of executable will
; be redirected.
; Please note that full path is also required.
logfile = C:\railsapp\log\service_wrapper.log
现在只需使用创建服务

sc create railsapp binPath= "C:\service_wrapper\service_wrapper.exe C:\service_wrapper\service_wrapper.conf" start= auto
(注意
binPath=
start=
后面的空格。没有它们它就无法工作)

那就从

net start railsapp

你在家里洗了水管

这可能会有帮助:谢谢@AliMasudianPour。。我会检查并返回。@AliMasudianPour它对我有用,你能把它作为一个答案添加进来吗,所以我可以给你的答案分配赏金。@Shruti我在下面添加了答案。