Two Guys Arguing

MonoRail with URL Rewriter working on IIS 7

Posted in .net, notes_to_self by benjaminplee on 02.25.10

I have spent the last few days setting up an existing client application in a new data center (IIS 7 +, Windows Server 2008, x64 bit).  Sounded easy, but it turns out that IIS 7 has some differences from IIS 6 and this app and its libraries (Castle project’s MonoRail & ActiveRecord, and URL Rewriter) were written for IIS 6.  Below are a few tips and tricks that helped us finally get the app up and running this afternoon.  Some of these may be obvious to your average .Net developer, but I come from a Java background and IIS configuration is a enigma wrapped in a mystery to me.  In hind site the few articles I found on Google were helpful and contained good information, but weren’t framed in a way that I immediately could get value from.

  • Setup the application pool with “Classic” managed pipeline mode.  From what I found, this has IIS run the app in IIS6 compatible mode.
  • Setup a new website using the above pool (not some other one, this is important)
  • Add handler mappings for MonoRail and the UrlRewriter (web.config XML snip-it can be found on my GitHub Gist 315115)
  • Most of the MonoRail and URL Rewriter install instructions focus on changing “Application Extension Mappings” in IIS 6.  These are found under “Handler Mappings” in IIS 7.  Note: these changes now modify your site’s web.config directly (instead of just being a IIS setting).  The changes are under the <handlers> element.  If you do an automated build (e.g. with NAnt or MSBuild) and push your files out these changes need to be committed into source control otherwise your normal file will override them the next time you deploy.
  • We ended up including both the 32 and 64 bit Framework isapi filter .dll’s as our handlers but it looks like Windows Server 2008 only cares about the 64 bit libraries.  We are still testing this with our builds because currently all of our workstations are 32 bit XP machines.
  • We also removed all of the original mappings since our application didn’t use them, static content is hosted elsewhere, and they were conflicting with the MonoRail mappings

About these ads
Tagged with: , ,

4 Responses

Subscribe to comments with RSS.

  1. Taing Nguonly said, on 06.08.10 at 2:28 am

    I have done a lot of search to deploy Monorail on IIS7.5 Windows 7 Ultimate. None of them is successful. Your solution works like a charm. Pretty cool!!!

    Thank you very much,

  2. Andre said, on 09.01.10 at 3:28 pm

    It works very well. Thanks!

  3. benjaminplee said, on 09.02.10 at 9:02 pm

    I am glad my pain helped. :-)

  4. Matthew Nichols said, on 01.03.11 at 7:46 pm

    Thank you for that. I struggled a while with this; your took care of my issue.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.