Monday, 19 December, 2005

Getting ASP.NET to work

When I tried to create an ASP.NET project from Visual Studio, I got this error in my error log:

aspnet_wp.exe could not be started. The error code for the failure is 80004005. This error can be caused when the worker process account has insufficient rights to read the .NET Framework files. Please ensure that the .NET Framework is correctly installed and that the ACLs on the installation directory allow access to the configured account.

Of course, before I checked the error log, I tried all manner of different things:  changing directory permissions, sharing folders, etc.  I don't remember what tripped me to checking the error log, but once I saw the error I was able to this Microsoft's Bnowledge Base article which supplied the solution.  The article talks about a domain controller, but the solution was the same for my Windows XP Pro system with Service Pack 2.

There are three solutions to the problem, all of which involve modifying the .NET Machine.config file (located, on my system, at C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\CONFIG).  The easy solution is to change the userName attribute in the <processModel> section to SYSTEM.  Doing so has serious security implications because the SYSTEM user is a highly privileged account.  You could do the same thing by using an administrator account.

The safe but slightly more involved way around the problem is to create an ASPUSER account and configure it as recommended in the Knowledge Base article.  Doing so ensures that your ASP.NET pages will run, but restricts the permissions so that a malicious program can't wreck havoc on your system.

Oddly, the KB article says that this bug was fixed with .NET Framework 1.1.  I have 1.1 on my system, and the bug still exists.  Perhaps the old version (.NET Framework 1.0) has some pieces left?  Or maybe it's a separate bug.