Windows Tip Sheet
Locating HTTP 500 Errors
Run this script to find all the HTTP 500 errors on your Web site.
HTTP 500 errors -- the bane of any Web site, as they represent an application
error of some kind -- are something you generally want to find and point out
to your Web developer, ideally before Web site users start complaining. Doing
so can be tough, though; a recent client of mine had dozens of servers to worry
about. I helped solve the problem by writing a short script:
Dim objFSO, objTS, strFile, strLine
strFile = InputBox("Enter path and filename of IIS log file to scan:")
If strFile <> "" Then
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(strFile) Then
Set objTS = objFSO.OpenTextFile(strFile)
Do Until objTS.AtEndOfStream
strLine = objTS.ReadLine
If InStr(1,strLine," - 500") <> 0 Then
WScript.Echo strLine
End If
Loop
End If
End If
WScript.Echo "Complete"
Given a log file and path name, this'll scan through the whole log in
search of 500 errors. When it finds them, it'll display the entire line
of the log file, which includes details like the date and time of the error
as well as the offending page. You can pipe the output to a text file, if you
prefer, or just let your developers run it themselves against copies of the
log files.
Additional Resources:
- A good place (in my opinion, at least) for scripted tools is my site, www.ScriptingAnswers.com,
or one of my recent books, Windows Administrator's Automation Toolkit.
- IIS
FAQ on HTTP 500 errors
- Microsoft
help on troubleshooting 500 errors
About the Author
Don Jones is a multiple-year recipient of Microsoft’s MVP Award, and is Curriculum Director for IT Pro Content for video training company Pluralsight. Don is also a co-founder and President of PowerShell.org, a community dedicated to Microsoft’s Windows PowerShell technology. Don has more than two decades of experience in the IT industry, and specializes in the Microsoft business technology platform. He’s the author of more than 50 technology books, an accomplished IT journalist, and a sought-after speaker and instructor at conferences worldwide. Reach Don on Twitter at @concentratedDon, or on Facebook at Facebook.com/ConcentratedDon.