Tuesday, August 17, 2010

Configuring ASP.NET MVC on Window Server 2003 x64 with IIS6

I'm posting this because it could save somebody hours or days of searching. I wish I had written this before I ran into the problem... (?)

At work today, I was trying to install our ASP.NET MVC web application on a Windows Server 2003 box that was running a 64 bit version of IIS 6.0. I had set everything up just as I have for every other test server that we were using, but this particular machine was giving me big fits.

I would map everything up and no matter what I did, I would get 404 Page Not Found errors from IIS. I made sure that my aspnet_isapi.dll was mapped for a wildcard filter, but still nothing. I was able to get the site to work if I added a custom route inside my Global.asax file to use {controller}.aspx/{action}/{id}. However, I wanted an extension-less approach to our pages that didn't use the "aspx hack" (as I so call it).

After looking all over MSDN, on every ASP.NET MVC guru's blog, and scouring StackOverflow, I finally got the tip that I needed deep within a list of random comments from an old haacked blog entry:
As an additional tip, please make sure you pick the correct version of aspnet_isapi.dll when you are running a 64-bit version of Windows/IIS. Sounds obvious but trust me, it'll give you a major headache if you don't.

Erik Burger
At the time it didn't make sense to me because there's only one aspnet_isapi.dll... or so I thought. The user was very vague and provided no additional information as to what he meant. However, this comment got to thinking that perhaps there was another aspnet_isapi.dll specific to 64bit web sites. I went searching, and in less than a minute, I found that there was!

For 32bit websites use this in your wildcard mapping:
C:\WINDOWS\microsoft.net\Framework\v2.0.50727\aspnet_isapi.dll
For 64bit websites use this one:
C:\WINDOWS\microsoft.net\Framework64\v2.0.50727\aspnet_isapi.dll
Once I did that, things started working… You're welcome.

1 comment:

Chris said...

Thanks for this, however I think it only applies when IIS is running in 64 bit mode. On my 2003/64bit server IIS is running in 32 bit mode, so I needed to use the non-64 bit aspnet_isapi.dll.

There's an error I got when using aspnet_regiis that said something to that effect.

So the 32 bit dll is working for me, but your mileage may vary!