The World’s Leading Microsoft .NET Magazine
   
 
timstall

Donate Today!

Search Box

 

Calendar

««Jul 2008»»
SMTWTFS
  
1
2
3
4
5
6789101112
13141516171819
20212223242526
2728293031

My RSS Feeds








Mailing List

Most Popular Tags

                                       

Resolving Http 500 Server Errors in ASP.Net and IIS 5.1

posted Monday, 4 April 2005

Every developer likes to take certain things for granted - like ASP.Net being configured correctly with IIS. However sometimes there will just be something non-obvious that is preventing ASP.Net pages from being served, returning an Http 500 error instead. The frustrating thing is that these are often caused by system configuration issues that most developers should never need to worry about. Below I offer some advice intended for IIS 5.1 on a local dev machine that resolves some of these errors. The problem is most likely:

  1. IIS or ASP.Net simply not installed correctly
  2. Security configuration

0. The Basics

First, try the classic: reboot your machine.

If that doesn't work, then turn off friendly errors in IE (tools > options > turn of friendly errors). This will give you a more helpful message like "Logon failure: user not allowed to log on to this computer." instead of just "500 Server error".

1. Check that IIS works

Be aware of the difference between ASP.Net and IIS. ASP may be installed fine, but IIS may be messed up. Some general tips:

  • See if you can view http://localhost/iishelp
  • Try viewing an HTML page through IIS. This totally bypasses any ASP.Net issues.

If you can't view IIS, then perhaps IIS is disabled or turned off.

2. Other Web Servers interfering with IIS

If this is the first time you installed IIS, perhaps there is another webserver running on your machine that is interfering with it (or if you disabled IIS and installed another Web Server). For example sometimes Java developers have another server using port 80 that blocks IIS. Try turning this other server off.

3. Uninstall and reinstall IIS and ASP.Net

Perhaps uninstalling and reinstalling will fix it.

  • Restart IIS by typing iisreset at the command line.
  • Reinstall ASP.Net by typing "aspnet_regiis.exe -i" at the command line.

If that doesn't work, you can uninstall IIS and ASP.Net, rename the inetpub directory to effectively delete it (while still saving your files), and then reinstall IIS and ASP.Net. This may reset user account systems.

4. Set ASP.Net security permissions

Make sure that the ASP.NET user has rights on Inetpub. Add the ASPNET user to INETPUB folder's users (Security tab in Properties) and granted it full control.

5. Check the Local security policy

In Admin Tools > Local Security Settings > Local Policies > Security Options > Audit Shut down system immediantly if unable to log secuiryt aufits --> should be disabled.

6. Check the Registry

In the registry editor (type regedit at the command line), check HKEY_LOCAL_MACHINE\SYSTEM\CurrentControLSet\CONTROL\LSA\CrashOnAuditFail

Set default = "0" (should not be "value not set")

7. Check the Machine.config for security settings

As a last resort, change machine.config,probably located in a directory like: C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\CONFIG\machine.config

Look for  the xml tag "<processModel". This will have an attribute userName="SYSTEM". Change this from "System" to "MACHINE".

Note that this is highly un-secure, but may be useful for letting you continue development while your IT staff investigates issues further.

 

Conclusion

I've had the misfortune of needing to fix this on many laptops now, and these hard-learned-tips have helped me out.

links: digg this    technorati    




1. Imad left...
Tuesday, 5 July 2005 1:54 pm

this is very important info but still I can't solve the problem. I can't browse the iishelp from IIS server and always I'm getting the "500 internal server error" upon opening an Asp.Net web application


2. Tim Stall left...
Wednesday, 6 July 2005 9:15 am

If you've done everything on this list, including setting your registry keys, machine.config, restarting... and you still can't even view the IIS help, then I'm not sure what it could be. You may need to check with Microsoft themselves. I could add your solution to this list so that others benefit from it.


3. pankaj left...
Saturday, 6 August 2005 2:20 pm

follow the below link and all semms OK...

trust it its tested......

http://www.windowsecurity.com/articles/Installing_Securing_IIS_Servers_Part 1.html

espacially the ASP.dll file entry..


4. Sangeetha left...
Thursday, 12 January 2006 10:22 am

This information is very useful. But am not able to create web application in .net 2003


5. Spanek left...
Thursday, 12 January 2006 10:57 am

If nothing else works try the things in the following site. It worked like a charm for my PC.

http://66.249.93.104/search?q=cache:QgJMDTIlUakJ:www.brooksyounce.com/xp_as p_fix.htm+xp_asp_fix&hl=it


6. Spanek left...
Thursday, 12 January 2006 11:00 am

Sorry but the previous link doesn't work.

Here is a copy - paste of the site :

Windows XP IIS 5.1 ASP Pages will not, cannot, can't, and won't Display/Load! aka: Cannot View ASP Pages aka: Problem with ASP Pages

After Hours of dreaded headache I finally discovered how to fix this problem without reinstalling Windows XP!! First TURN OFF Friendly ERROR URL's (an Option in IE)

Check Event Log! Check your Event Viewer for these errors... MSDTC errors (4427,4691,4135 are common error events for this) W3SVC Event 36 "The server failed to load application '/LM/W3SVC/1/ROOT/'. The error was 'Class not registered"

Of Course Try these First... At the command line type "sfc /scannow" (have your XP CD in the CD drive) Reinstall Service Pack 1 for Windows XP Try uninstalling IIS then reinstalling it

How to Fix it! (if nothing else can!) Open "Control Panel" and then "Administrative Tools" then Open "Services"... Locate the "Distributed Transaction Coordinator" make sure the process is "Started" and "Automatic" (If its not, open a command line and type "msdtc -install", then try and start the service) Open a command line and type the following...

  • cd %windir%\system32\inetsrv

  • rundll32 wamreg.dll, CreateIISPackage (NOTE: "CreateIISPackage" must be typed exactly; it is case-sensitive.)

  • regsvr32 asptxn.dll (wait for a dialog box to notify you asptxn has registered correctly)

  • IISRESET /restart

Open "Control Panel" then "Component Services"... You should see all three IIS COM+ applications that have been recreated.

Proble fixed!!


7. GOGMU left...
Monday, 23 January 2006 5:16 pm

Spanek, Your suggestion of "How to Fix it! (if nothing else can!)" worked for me. Thank you.


8. Marc left...
Thursday, 16 February 2006 10:54 am

I tried the above with no effect.

However, I did add the IWAM user account into local administrator group and that sorted it.


9. Keify left...
Tuesday, 28 February 2006 12:00 am

Hi guys out there. I face the same issues that you guys did. And after detail checking, include done all step mention include Uninstall and reinstall IIS and ASP.Net, Check the Local security policy, Set ASP.Net security permissions, Check the Registry, Check the Machine.config for security settings. I figure out it the bloody MS service pack 2 that is playing up. Try uninstall SP2 and try load your aspx page. If it work, then re-install your SP2 if require by you. Good luck


10. rnvagh left...
Tuesday, 7 March 2006 8:22 am

when i am opening or creating the error in asp.net on windows xp sp2 occurs

errors are

1> "documents are not available because server is not running"

2> "required components are not installed on your computer" and tell to update by using asp.net cd but after updating the error remains as it is.

3>"documents in this folder are moved or deleted"

what should i do.


11. yaya left...
Wednesday, 26 April 2006 3:42 am

i fixed my massive IIS problems by these combos

1) Re-install Microsoft DTC msdtc on KB891801 for Windows XP Professional.

2) Refig the iis com+ packages as previously described in this article.


12. Andy left...
Thursday, 22 June 2006 8:10 pm

Spanek,

You are a friggin hero! I spent hours on this before I came across your post here. Many thanks!


13. Marie left...
Monday, 2 October 2006 1:09 am

Spanek, thank you!! Your "if nothing else can" fix for IIS/ASP.NET finally got my system behaving properly. My appreciation for finally ending my IIS headaches.


14. Jilltre left...
Friday, 10 November 2006 11:17 am

hopefully someone is still watching this thread...

when I get to this line:

regsvr32 asptxn.dll

I get a dllRegisterServer in asptxn.dll failed...

any reason that would happen?


15. Koriolys left...
Monday, 15 January 2007 10:33 am

Hi guys, I get the same error, spent hours to get it solved.

I installed firefox to check if the problem was an asp.net or IIS one, and with firefox, all worked fine... So the simplest solution appears to my mind : the problem was with IE Proxy settings... Make sure "Bypass proxy server for local address" is turned on...

That solved my problem :)

Koriolys