让 Rails 应用程序在 IronRuby Rack 下运行

发布于 2024-08-29 13:02:27 字数 5875 浏览 5 评论 0原文

还有人玩ironruby吗?

我已成功在 IIS 5.1 下的本地计算机上运行 IronRuby.Rails.Example 项目。我现在正尝试以同样的方式运行我自己的演示 Rails 站点。

我的 web.config 与示例项目略有不同。我尝试只使用 IronRuby 1.0 中分发的内容以及我使用 gems 安装的内容。

我收到以下错误,这并没有让我继续下去:

D:/demo/config/boot.rb:66:在“退出”中: 退出(系统退出)

在尝试了许多不同的事情之后,我认为它在寻找宝石时遇到了问题。我已附上我的网络配置和ironrack.log。有人指出我做错了什么吗?

谢谢!

<?xml version="1.0"?>
<configuration>
    <configSections>
        <!-- custom configuration section for DLR hosting -->
        <section name="microsoft.scripting" type="Microsoft.Scripting.Hosting.Configuration.Section, Microsoft.Scripting" requirePermission="false"/>
    </configSections>
    <system.webServer>
        <handlers>
            <!-- clear all other handlers first. Don't do this if you have other handlers you want to run -->
            <clear/>
            <!-- This hooks up the HttpHandler which will dispatch all requests to Rack -->
            <add name="IronRuby" path="*" verb="*" type="IronRuby.Rack.HttpHandlerFactory, IronRuby.Rack" resourceType="Unspecified" requireAccess="Read" preCondition="integratedMode"/>
        </handlers>
    </system.webServer>
    <system.web>
        <!-- make this true if you want to debug any of the DLR code, IronRuby.Rack, or your own managed code -->
        <compilation debug="true"/>
    <httpHandlers>
      <!-- clear all other handlers first. Don't do this if you have other handlers you want to run -->
      <clear/>
      <!-- This hooks up the HttpHandler which will dispatch all requests to Rack -->
      <add path="*" verb="*" type="IronRuby.Rack.HttpHandlerFactory, IronRuby.Rack" />
    </httpHandlers>
    </system.web>
    <!-- DLR configuration. Set debugMode to "true" if you want to debug your dynamic language code with VS -->
    <microsoft.scripting debugMode="false">
        <options>
            <!-- Library paths: make sure these paths are correct -->
            <!--<set option="LibraryPaths" value="..\..\..\Languages\Ruby\libs\;
                                                  ..\..\..\..\External.LCA_RESTRICTED\Languages\Ruby\ruby-1.8.6p368\lib\ruby\site_ruby\1.8\;
                                                  ..\..\..\..\External.LCA_RESTRICTED\Languages\Ruby\ruby-1.8.6p368\lib\ruby\1.8\"/>-->
            <set option="LibraryPaths" value="C:\IronRuby\lib\IronRuby;C:\IronRuby\lib\ruby\1.8;C:\IronRuby\lib\ruby\site_ruby;C:\IronRuby\lib\ruby\site_ruby\1.8"/>
        </options>
    </microsoft.scripting>
    <appSettings>
        <add key="AppRoot" value="."/>
        <add key="Log" value="ironrack.log"/>
        <!-- <add key="GemPath" value="..\..\..\..\External.LCA_RESTRICTED\Languages\Ruby\ruby-1.8.6p368\lib\ruby\gems\1.8"/> -->
        <add key="GemPath" value="C:\IronRuby\Lib\ironruby\gems\1.8\gems"/>
        <add key="RackEnv" value="production"/>
    </appSettings>
</configuration>

=== Booting ironruby-rack at 4/15/2010 1:27:12 PM [DEBUG] >>> TOPLEVEL_BINDING = binding
=> Setting GEM_PATH: 'C:\\IronRuby\\Lib\\ironruby\\gems\\1.8\\gems'
=> Setting RACK_ENV: 'production'
=> Loading RubyGems [DEBUG] >>> require 'rubygems'
=> Loading Rack >=1.0.0 [DEBUG] >>> gem 'rack', '>=1.0.0';require 'rack'
=> Loaded rack-1.1
=> Application root: 'D:\\demo'
=> Loading Rack application [DEBUG] >>> Rack::Builder.new { (
    require "config/environment"

    ENV['RAILS_ENV'] = 'development'

    use Rails::Rack::LogTailer
    use Rails::Rack::Static
    run ActionController::Dispatcher.new
    ) }.to_app exit
    D:/demo/config/boot.rb:66:in `exit': exit (SystemExit)
        from D:/demo/config/boot.rb:66:in `load_rails_gem'
        from D:/demo/config/boot.rb:54:in `load_initializer'
        from D:/demo/config/boot.rb:38:in `run'
        from D:/demo/config/boot.rb:11:in `boot!'
        from D:/demo/config/boot.rb:110
        from C:/IronRuby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from C:/IronRuby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from D:/demo/config/environment.rb:7
        from C:/IronRuby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from C:/IronRuby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from (eval):1
        from C:/IronRuby/lib/ironruby/gems/1.8/gems/rack-1.1.0/lib/rack/builder.rb:46:in `instance_eval'
        from C:/IronRuby/lib/ironruby/gems/1.8/gems/rack-1.1.0/lib/rack/builder.rb:46:in `initialize'
        from (eval):0
        from D:\Dev\ironruby\ironruby-ironruby-20bc41b\Merlin\Main\Hosts\IronRuby.Rack\RubyEngine.cs:52:in `Execute'
        from D:\Dev\ironruby\ironruby-ironruby-20bc41b\Merlin\Main\Hosts\IronRuby.Rack\RubyEngine.cs:45:in `Execute'
        from D:\Dev\ironruby\ironruby-ironruby-20bc41b\Merlin\Main\Hosts\IronRuby.Rack\Application.cs:68:in `Rackup'
        from D:\Dev\ironruby\ironruby-ironruby-20bc41b\Merlin\Main\Hosts\IronRuby.Rack\Application.cs:32:in `.ctor'
        from D:\Dev\ironruby\ironruby-ironruby-20bc41b\Merlin\Main\Hosts\IronRuby.Rack\HttpHandlerFactory.cs:37:in `GetHandler'
        from System.Web:0:in `MapHttpHandler'
        from System.Web:0:in `System.Web.HttpApplication.IExecutionStep.Execute'
        from System.Web:0:in `ExecuteStep'
        from System.Web:0:in `ResumeSteps'
        from System.Web:0:in `System.Web.IHttpAsyncHandler.BeginProcessRequest'
        from System.Web:0:in `ProcessRequestInternal'
        from System.Web:0:in `ProcessRequestNoDemand'
        from System.Web:0:in `ProcessRequest'

Anyone else playing with ironruby?

I have successfully got the IronRuby.Rails.Example project running on my local machine under IIS 5.1. I am now attempting to get my own demo rails site running in the same way.

My web.config is slightly different from the example project. I am attempting to only use what was distributed with IronRuby 1.0 and what I have installed using gems.

I am getting the following error which doesn't give me a lot to go on:

D:/demo/config/boot.rb:66:in `exit':
exit (SystemExit)

After trying many different things, I think it is having a problem finding gems. I have attached my web config and ironrack.log. Does anyone have pointers on what I am doing wrong?

Thanks!

<?xml version="1.0"?>
<configuration>
    <configSections>
        <!-- custom configuration section for DLR hosting -->
        <section name="microsoft.scripting" type="Microsoft.Scripting.Hosting.Configuration.Section, Microsoft.Scripting" requirePermission="false"/>
    </configSections>
    <system.webServer>
        <handlers>
            <!-- clear all other handlers first. Don't do this if you have other handlers you want to run -->
            <clear/>
            <!-- This hooks up the HttpHandler which will dispatch all requests to Rack -->
            <add name="IronRuby" path="*" verb="*" type="IronRuby.Rack.HttpHandlerFactory, IronRuby.Rack" resourceType="Unspecified" requireAccess="Read" preCondition="integratedMode"/>
        </handlers>
    </system.webServer>
    <system.web>
        <!-- make this true if you want to debug any of the DLR code, IronRuby.Rack, or your own managed code -->
        <compilation debug="true"/>
    <httpHandlers>
      <!-- clear all other handlers first. Don't do this if you have other handlers you want to run -->
      <clear/>
      <!-- This hooks up the HttpHandler which will dispatch all requests to Rack -->
      <add path="*" verb="*" type="IronRuby.Rack.HttpHandlerFactory, IronRuby.Rack" />
    </httpHandlers>
    </system.web>
    <!-- DLR configuration. Set debugMode to "true" if you want to debug your dynamic language code with VS -->
    <microsoft.scripting debugMode="false">
        <options>
            <!-- Library paths: make sure these paths are correct -->
            <!--<set option="LibraryPaths" value="..\..\..\Languages\Ruby\libs\;
                                                  ..\..\..\..\External.LCA_RESTRICTED\Languages\Ruby\ruby-1.8.6p368\lib\ruby\site_ruby\1.8\;
                                                  ..\..\..\..\External.LCA_RESTRICTED\Languages\Ruby\ruby-1.8.6p368\lib\ruby\1.8\"/>-->
            <set option="LibraryPaths" value="C:\IronRuby\lib\IronRuby;C:\IronRuby\lib\ruby\1.8;C:\IronRuby\lib\ruby\site_ruby;C:\IronRuby\lib\ruby\site_ruby\1.8"/>
        </options>
    </microsoft.scripting>
    <appSettings>
        <add key="AppRoot" value="."/>
        <add key="Log" value="ironrack.log"/>
        <!-- <add key="GemPath" value="..\..\..\..\External.LCA_RESTRICTED\Languages\Ruby\ruby-1.8.6p368\lib\ruby\gems\1.8"/> -->
        <add key="GemPath" value="C:\IronRuby\Lib\ironruby\gems\1.8\gems"/>
        <add key="RackEnv" value="production"/>
    </appSettings>
</configuration>

=== Booting ironruby-rack at 4/15/2010 1:27:12 PM [DEBUG] >>> TOPLEVEL_BINDING = binding
=> Setting GEM_PATH: 'C:\\IronRuby\\Lib\\ironruby\\gems\\1.8\\gems'
=> Setting RACK_ENV: 'production'
=> Loading RubyGems [DEBUG] >>> require 'rubygems'
=> Loading Rack >=1.0.0 [DEBUG] >>> gem 'rack', '>=1.0.0';require 'rack'
=> Loaded rack-1.1
=> Application root: 'D:\\demo'
=> Loading Rack application [DEBUG] >>> Rack::Builder.new { (
    require "config/environment"

    ENV['RAILS_ENV'] = 'development'

    use Rails::Rack::LogTailer
    use Rails::Rack::Static
    run ActionController::Dispatcher.new
    ) }.to_app exit
    D:/demo/config/boot.rb:66:in `exit': exit (SystemExit)
        from D:/demo/config/boot.rb:66:in `load_rails_gem'
        from D:/demo/config/boot.rb:54:in `load_initializer'
        from D:/demo/config/boot.rb:38:in `run'
        from D:/demo/config/boot.rb:11:in `boot!'
        from D:/demo/config/boot.rb:110
        from C:/IronRuby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from C:/IronRuby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from D:/demo/config/environment.rb:7
        from C:/IronRuby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from C:/IronRuby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from (eval):1
        from C:/IronRuby/lib/ironruby/gems/1.8/gems/rack-1.1.0/lib/rack/builder.rb:46:in `instance_eval'
        from C:/IronRuby/lib/ironruby/gems/1.8/gems/rack-1.1.0/lib/rack/builder.rb:46:in `initialize'
        from (eval):0
        from D:\Dev\ironruby\ironruby-ironruby-20bc41b\Merlin\Main\Hosts\IronRuby.Rack\RubyEngine.cs:52:in `Execute'
        from D:\Dev\ironruby\ironruby-ironruby-20bc41b\Merlin\Main\Hosts\IronRuby.Rack\RubyEngine.cs:45:in `Execute'
        from D:\Dev\ironruby\ironruby-ironruby-20bc41b\Merlin\Main\Hosts\IronRuby.Rack\Application.cs:68:in `Rackup'
        from D:\Dev\ironruby\ironruby-ironruby-20bc41b\Merlin\Main\Hosts\IronRuby.Rack\Application.cs:32:in `.ctor'
        from D:\Dev\ironruby\ironruby-ironruby-20bc41b\Merlin\Main\Hosts\IronRuby.Rack\HttpHandlerFactory.cs:37:in `GetHandler'
        from System.Web:0:in `MapHttpHandler'
        from System.Web:0:in `System.Web.HttpApplication.IExecutionStep.Execute'
        from System.Web:0:in `ExecuteStep'
        from System.Web:0:in `ResumeSteps'
        from System.Web:0:in `System.Web.IHttpAsyncHandler.BeginProcessRequest'
        from System.Web:0:in `ProcessRequestInternal'
        from System.Web:0:in `ProcessRequestNoDemand'
        from System.Web:0:in `ProcessRequest'

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

回眸一笑 2024-09-05 13:02:27

exit 是 ruby​​ 中以编程方式退出的方法。

rack 背后的想法是它是 ruby​​ web 框架和实际应用服务器之间的中间件。通过解耦,它让无数的 ruby​​ 框架(rails、sinatra、ramaze 等)针对单个接口,并且无数的应用程序服务器(mongrel、apache with guest、unicorn 等)也可以执行相同的操作。看起来 IR 人员正在尝试让机架与 IIS 一起工作。我快速搜索了机架上的 Rails 配置,发现 此页面

输出看起来类似于您在 Rails 服务器方法中看到的内容。我会尝试找出这是从哪里来的

require "config/environment"

ENV['RAILS_ENV'] = 'development'

use Rails::Rack::LogTailer
use Rails::Rack::Static
run ActionController::Dispatcher.new
) }.to_app exit

,并尝试使其更接近该指南中的内容。如果你找不到它,我会尝试在 IR 邮件列表上发帖。他们往往相当友好,而且由于目前这是一个边缘问题,因此他们可能是唯一拥有足够专业知识可以提供帮助的人。

祝你好运 :-)

exit is the way to programmatically quit in ruby.

The idea behind rack is it is a middleware between ruby web frameworks, and the actual app server. By decoupling that, it lets the myriad ruby frameworks (rails, sinatra, ramaze, etc) target a single interface, and the myriad app servers (mongrel, apache with passenger, unicorn, etc) do the same. What it looks like is the IR guys are trying to get rack working with IIS. I did a quick googling for rails on rack configuration, and found this page

the output looks similar to what you see in the rails server method. I would try to figure out where this is coming from

require "config/environment"

ENV['RAILS_ENV'] = 'development'

use Rails::Rack::LogTailer
use Rails::Rack::Static
run ActionController::Dispatcher.new
) }.to_app exit

and try to make it closer to what is in that guide. If you can't get it there, I would try posting on the IR mailing list. They tend to be fairly friendly, and since this is such a fringe thing at the moment, they may be the only ones with enough expertise to help.

Good luck :-)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文