jschementi / ironruby forked from ironruby/ironruby
- Source
- Commits
- Network (82)
- Issues (19)
- Downloads (0)
- Wiki (1)
- Graphs
-
Tree:
84f13b1
Jimmy Schementi (author)
Wed May 27 11:23:26 -0700 2009
commit 84f13b1901330326bc7a098463575a7d1cdc2d37
tree fdeb25ceed34ef0be2654d3cb18495d7d95f2574
parent bc8949eb1485e88f37efb066210ce957ed43aebb
tree fdeb25ceed34ef0be2654d3cb18495d7d95f2574
parent bc8949eb1485e88f37efb066210ce957ed43aebb
Merlin/Main/Hosts/IronRuby.Rack/README.markdown
ironruby-rack
Run Rack-based web applications on IIS with IronRuby
Setup
Install Rack
igem install rack
Install IIS (this set of features might be overkill)
- Control Panel -> Programs -> Turn Windows Features on or off
- Internet Information Services
- World Wide Web Services, enable:
- Application Development Features
- Common HTTP Features -> Default Document, Directory Browsing, HTTP Redirection and Static Content
- Performance features -> Static Content Compression
- Security -> Request Filtering and Windows Authentication
- Web Management Tools, enable:
- IIS 6 Management Compatibility -> IIS Metabase and IIS6 configuration compatibility
- IIS Management Console
- IIS Management Script and Tools
- IIS Management Service
- World Wide Web Services, enable:
Give permissions to IIS
- IIS needs to have permission to open files in this project, as well as in the Ruby standard library. Grant IIS_IUSER permission to this directory, as well as the Ruby standard library (usually C:\ruby\lib\ruby)
Open IronRack.sln in Visual Studio
- Click "OK" to prompts about creating virtual directories, otherwise not all the project files will load.
- Right-click on IronRuby.Rack.App and select "Set as StartUp Project".
Building
Simply build the solution in Visual Studio. It will build IronRuby, as well as IronRuby.Rack.dll.
Running
Click "Debug" -> "Start without Debugging" to run the Rack Application, which will just navigate to http://localhost/IronRuby.Rack.Example
How it works
- Uses ASP.NET's HttpHandlers to
- Registering IronRuby.Rack in the Rack-based application's Web.config
- Load a Rack-based application on startup (HttpHandlerFactory and
Application constructor).
- Initializes Rack and runs the application's config.ru, which tells Rack what application (any Ruby object that responds to 'call')
- Intercept web requests (HttpHandler.ProcessRequest)
- Creates a Request and a Response, and passes it off to IIS.Handle which:
- Set up the environment according to the Rack specification
- Calls Application.Call with the prepared environment, which delegates to the Rack application's "call" method (registered in the config.ru file). All C# <-> Ruby interaction happens in the RubyEngine.
- Rack application does its thing (process Rails/Sinatra request, or deal with things itself) and returns a response according to the Rack specification.
- Takes the Rack response and pass the appropriate data to the IIS response (response body, status, headers)
- Creates a Request and a Response, and passes it off to IIS.Handle which:

