Rails on IIS


#1

I just spent the last two days trying to get Rails on IIS to work with
Windows 2003/IIS 6.0. I think I’ve finally got it working, but it took
more googling than I care to describe. Now I’ve got a few questions:

  1. Is there some ‘official’ Rails on IIS guide on this site on another
    official ruby site that’s known to work well?
  2. If not, can someone make one using my links/notes below?
  3. What is the latest version of request.rb with the necessary hack for
    IIS that actually works? (see notes below).

My notes/links:

  • This was the best tutorial I found:
    http://made-of-stone.blogspot.com/2006/01/rails-on-iis-revisited.html.
    It was incomplete though. Use my notes below as well. Also, it didn’t
    really describe how to install rails in /vendor, so I just
    modified request.rb in C:\ruby… Note that the mods are the ones I
    described below. If you’ve got a recent version of rails, your
    requests.rb will be the same as in this tutorial but still won’t work.

  • I kept getting 403 errors until I followed these instructions
    (http://www.beamartyr.net/articles/iisperl.html) for setting up Perl
    with IIS. Basically, you give the user account some extra user rights.

  • Don’t forget to make all the dll’s and .exe’s described executable to
    whatever user your IIS app pool is running as, and make the
    IconicIsapiRewrite and /log directories writeable.

  • Even though I just downloaded my version of Rails (1.1.0 per
    scripts/about) using gems, and the file notes that it includes an IIS
    hack, I had to modify request.rb as described here at
    http://colinramsay.co.uk/diary/archives/000297.html. What’s more, even
    that didn’t work. I had to replace the return (uri) in request_uri with
    ‘uri.sub(/^///, “/”)’.


#2

Adam Carheden wrote:

My notes/links:
with IIS. Basically, you give the user account some extra user rights.
‘uri.sub(/^///, “/”)’.

Hi Adam,

I've been looking for solutions on how to get ror working on IIS too

but same as you… I haven’t found any good step by step info how to set
it up.

This is a big stopper for people wanting to try out rails… if you
happen to make it work. please let me know…

thanks,

Erwin Q.


#3

Me too I seek a solution more simple for windows 2K/IIS 5
I have a server dedicated and i can’t use it

2006/4/4, Erwin Q. removed_email_address@domain.invalid:


#4

Thanks for this IIS BestOf

During my IIS6 setup I’ve also used this link

http://phplens.com/phpeverywhere/fastcgi-php

Background infos about FastCGI are also valuables for Ror.


#5

it’s same thing for IIS 5. 'Cause i seek some infos for my network
Design.

2006/4/5, Mathieu C. removed_email_address@domain.invalid:


#6

My experience with this is don’t bother. Apache is easy to set up behind
IIS. You can forward requests using ISAPI Rewrite and nobody will know
the
difference.

We are using this now and we are a windows shop. Eventually we’ll
implement
ISA server as our proxy.


#7

Adam Carheden wrote:

I just spent the last two days trying to get Rails on IIS to work with
Windows 2003/IIS 6.0. I think I’ve finally got it working, but it took
more googling than I care to describe. Now I’ve got a few questions:

  1. Is there some ‘official’ Rails on IIS guide on this site on another
    official ruby site that’s known to work well?
  2. If not, can someone make one using my links/notes below?

Hi Adam,

Why not post it to the wiki. That way it might just ‘become’ the
official Rails on IIS guide. What would you do amend, update or
replace:

http://wiki.rubyonrails.com/rails/pages/HowtoSetupIIS

Alan


#8

Can’t right now but search the list… I’ve posted howtos on this a few
times. If you still can’t find it, remind me later and when I get a
moment
I’ll post it again


#9

Oh and Mongrel is a pain on Windows… Apache is still better because you
can
easily manage your assets (Apache can use rewrite base so I can mount
apps
to a subfolder as opposed to a separate host. I have not been able to
make
that work with Mongrel yet. Plus it seems to run slower on Windows than
Apache (in my tests) but Ruby on Windows is slow anyway (compared to
Linux)


#10

Sorry for my ‘dump’ question.
If setup RoR on my IIS sever , after i can use dotNet ? there is no
problem
between dotNet and Ruby ?

2006/4/5, Brian H. removed_email_address@domain.invalid:


#11

Hello Brian,

My experience with this is don’t bother. Apache is easy to set up behind
IIS. You can forward requests using ISAPI Rewrite and nobody will know the
difference.

Would you share your Rewrite httpd.ini please, I’ll like to have a
backup plan like this but using Mongrel.

Thanks


#12

Brian H. wrote:

Oh and Mongrel is a pain on Windows…

It can be made easy. go to vmware.com and download the free player, then
download a community built appliance (perhaps Fedora or Debian) and
install Mongrel there. =)

Zach


#13

Erwin Q. wrote:

(http://www.beamartyr.net/articles/iisperl.html) for setting up Perl
that didn’t work. I had to replace the return (uri) in request_uri
happen to make it work. please let me know…

Any particular reason you want to run IIS? It seems odd. I have never
seen such a thing.

Zach


#14

For Me , i have yet a server dedicated for my dotNet application.
I don’t want buy an other.

2006/4/5, zdennis removed_email_address@domain.invalid:


#15

lol

if i can use RoR on IIS , i can also use a linux sever with mono :stuck_out_tongue:
It’ an other solution :smiley:

Bolo
2006/4/6, Brian H. removed_email_address@domain.invalid:


#16

That’s cheating! :slight_smile:


#17

Hey Brian,

Curious what kind of ³pain² you¹re seeing on Windows. If you can give
me
some feedback I¹ll roll it into the 0.4 release when I reconcile how the
POSIX and Windows worlds work for Mongrel.

Zed A. Shaw


http://mongrel.rubyforge.org/


#18

Zed:

There are two issues… one of which I don’t think you can fix because I
think it’s related directly to ruby on windows. The issue is basically
that
there is no difference in performance whether you use Apache+FCGI,
Apache+SCGI, or other approaches. According to HTTPerf and other
tools,
the req/second are all roughly the same… about 5 times slower than on
Linux.

The other issue is relative URLs, assets, and other minor things that
can
get irritating. (I don’t think it’s just Windows).

Mongrel is awesome if you just want to serve one Rails site using its
own
port or its own vhost. But not so good for integrating with another web
server (one that sucks as bad as IIS).

Let’s say I would like to deploy an application at /chemistry/labs/
instead
of /

(The reason I would want to do this is because IIS doesn’t have the
ability
to do reverse proxying… so I need to have the path from the front-side
server equal to the path on Mongrel so I can do some clean mapping
between
the servers.)

What I do with Apache is simply apply a RewriteBase attribute in the
.htaccess file and set it to /chemistry/labs/
Then www.uwec.edu/chemistry/labs easily forwards to
internal.uwec.edu:3000/chemistry/labs and I don’t have any issues with
relative URLS being generated by the Rails program. )

With Mongrel, I can’t really do that, so I tried setting a value for
request_uri

ActionController::AbstractRequest.relative_url_root = "/chemistry/labs’

And this works remarkably well, except for one small problem…
images,
stylesheets, and javascript files no longer work :slight_smile: The URLS are
rewritten
correctly, but they are still served out of the public folder

In this case, requests to /chemistry/labs/images/ are returned as 404
errors… but /images returns correctly.

This is basically the only issue we have found with this software and
we’ve
found no way around it. However, I don’t think it’s a show-stopper; it
just
means that we can’t use it in the way we’d like.

Again, this is trivial. It would be great if there was a way this could
be
solved… some config setting or something. Mongrel is exactly what we
need
in our environment. However, don’t break your neck over this just
because we
would find it useful.

I probably should have phrased “pain on windows” differently.


#19

Well, simplest way would be to run mongrel and IIS behind pound:

http://www.apsis.ch/pound/

Even gives you WebDAV through the proxy and easy SSL setup.

When you set it up you actually have IIS and X number of Mongrels on the
same level. So instead of:

IIS -> [mongrel1, mongrel2, mongrel3]

You do:

pound -> [IIS, mongrel1, mongrel2, mongrel3]

Then pound looks at cookies and request URIs to determine how to route
the
requests.

Zed A. Shaw


http://mongrel.rubyforge.org/


#20

Thanks Zed, I think you have mentioned this before. Is their any
further
info available on setting up pound on windows with iis.

Thanks