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