For many of us, just updating to the latest Server software isn’t in all cases an option.
Make sure .NET 4.0 is installed.
The most reliable way to check the .NET framework and service pack versions is to consult the registry.
This is a good table that will tell you this.
If you find .NET 4.0 isn’t installed, you’ll have to download and install it.
Make sure ASP.NET 4.0 is activated for your web site
First you’ll need your web sites SiteID.
Open IIS Manager.
Click the Web Sites folder in the left pane. In the right pane, you’ll see all your web sites listed.
There should be a column called “Identifier”. The fields beneath are the web sites SiteID’s.
Take note of your web sites Id.
Navigate to ASP.NET’s default path C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319
You’ll then need to run the following command:
aspnet_regiis -lk | find "Id"
Where “Id” is your web sites Id as you recorded above.
You need the quotes too.
This should produce the following:
"W3SVC/Id/ROOT/ [your .NET framework version number]"
That’s what your website’s virtual path in IIS6.0 looks like with the .NET framework version tacked on the end, without the quotes.
Id of course will be your web sites Id.
If the .NET framework version isn’t v4.0.30319, you’ll need to register it.
Run the following command:
aspnet_regiis.exe -norestart -s "W3SVC/Id/ROOT/"
Id is once again your web sites Id.
This should register ASP.NET 4.0 with your web site.
IIS won’t need restarting.
Make sure the App pool your web site is going to run in is dedicated to .NET 4.0
Here’s some doc for aspnet_regiis.exe
Make sure ASP.NET MVC 4 is installed on the target machine
or the project is set to bin deploy
I prefer to bin deploy, so we don’t clutter up the old server.
Any additional libraries I need,
I include by using NuGet at solution level,
This allows many projects to use the same packages.
It looked like after some research,
but before I actually started on this,
that we would run into this problem, but no,
It turned out that our .NET 4 ASP.NET ISAPI extension was already enabled.
File extension mapping
The file extension in the URL (.aspx for example) must be mapped to aspnet_isapi.dll.
If it is, and there’s a .aspx in the URL,
aspnet_isapi.dll invokes ASP.NET.
If ASP.NET is invoked, (because UrlRoutingModule is a .NET IHttpModule) UrlRoutingModule gets invoked.
IIS 6 only invokes ASP.NET when it sees a “filename extension” in the URL that’s mapped to aspnet_isapi.dll
This means we have to do some work to get IIS 6 to recognise files that don’t have this mapping.
As this was a test deployment, I wasn’t too concerned about speed.
So decided to use wildcard mapping for aspnet_isapi.dll, as it was the easiest to setup.
Open IIS Manager
1. Right click on your web app and select Properties
2. Select the HomeDirectory tab
3. Click on Configuration
4. Under the Wildcard application maps edit box,
—-click Insert (not Add)
5. Enter C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319
—-\aspnet_isapi.dll for the “Executable:”
6. Uncheck “Verify that file exists”
7. Click OK, OK
There are a few ways of achieving a similar result.
Here are some ideas:
Another resource that’s well worth a read is the “Test Drive ASP.NET MVC” book.
In chapter 12 it talks a little about this also in the section… IIS 6.0 on Windows Server 2003 or XP Pro x64