Wednesday 12 January 2011

aspnet_wp.exe could not be started (error C0000142)

I restarted my computer and afterwards I could not access any of the local sites via IIS. The error message in the Application logs of the EventViewer was
Event Type: Error
Event Source: ASP.NET 4.0.30319.0
Description:
aspnet_wp.exe could not be started. The error code for the failure is C0000142. 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.
I did the classic
iisreset /stop
%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i
iisreset /start
to no avail. I was about to curse and restart the computer again when I found this pretty little link: IIS doesn't start. Error code: C0000142. A solution is at the bottom, as the least voted answer: Go to Task Manager, kill explorer.exe, Run another explorer.exe. This starts IIS (aspnet_wp.exe under inetinfo.exe) correctly.

Update: It bugged me that I had to kill explorer.exe. First of all it is a manual solution, then it always messed with my system tray icons. So I searched a little more. Short story shorter, you need to edit machine.conf and replace <processModel autoConfig="true" /> with <processModel userName="system" password="AutoGenerate" />. That effectively makes ASP.Net work under the System account, not the default machine. It does indicate the issue is permission related, but I don't get exactly where and why it should work if I restart explorer.exe. As long as you don't mind running ASP.Net under the System account, this solution seems to solve it. Here is the long version.

Note: you can find the machine.config file in %windir%\Microsoft.NET\Framework\[framework version]\Config\machine.config.

7 comments:

  1. thanks, solution suggested by you worked for me too.

    ReplyDelete
  2. You are welcome! Check out the permanent solution in the updated post.

    ReplyDelete
  3. Thank you very much. It worked for me too. The error occurred after installing VS2010 side by side with an existing VS2005 on an XPProSP3 machine. Framework 4 or Vs2010 must have messed up my IIS5.1. But thanks again!

    ReplyDelete
  4. Thank you, your solution is the best ever after long research in the net

    ReplyDelete
  5. Brilliant! Thanks!

    ReplyDelete
  6. Thank U so very much, I had been struggling to fix this error and had tried atleast 30 different things that didnt work. This error happened after I installed DotNet 4.0 and was trying to run IIS as a process; so that I could attach it to my delphi application.

    ReplyDelete
  7. After a whole day's work...finally this worked.........thank you!!!!!

    ReplyDelete