Understanding and Resolving HTTP Error Codes
This guide helps diagnose and fix common HTTP errors on Windows/IIS hosting.
403 Forbidden Error
Common Causes:
- Missing default document (index.html, default.aspx, etc.)
- Directory browsing disabled with no default page
- IP restrictions or access rules blocking access
- Incorrect file/folder permissions
- web.config authorization rules
Solutions:
1. Add Default Document:
- In Plesk, go to Websites & Domains
- Select Hosting Settings
- Verify default documents are configured
2. Check web.config Authorization:
<!-- Remove restrictive authorization --> <authorization> <allow users="*"/> </authorization>
3. Enable Directory Browsing (if needed):
<system.webServer> <directoryBrowse enabled="true" /> </system.webServer>
500 Internal Server Error
Common Causes:
- Syntax errors in web.config
- Application code exceptions
- Missing dependencies or assemblies
- Database connection failures
- Insufficient permissions on app folders
Solutions:
1. Enable Detailed Errors (temporarily):
<system.webServer> <httpErrors errorMode="Detailed" /> </system.webServer> <!-- For ASP.NET --> <system.web> <customErrors mode="Off"/> </system.web>
2. Check Application Logs:
- In Plesk: Websites & Domains > Logs
- Look for entries with status code 500
- Check Windows Event Viewer (if available)
3. Validate web.config:
- XML must be well-formed
- All tags properly closed
- No duplicate sections
502 Bad Gateway Error
Common Causes:
- Application pool crash or timeout
- ASP.NET Core application not starting
- Kestrel server not responding
- Incorrect hosting model configuration
Solutions:
For ASP.NET Core Applications:
- Check stdout log in the application folder
- Verify .NET runtime version is installed
- Ensure web.config has correct hosting settings:
<aspNetCore processPath="dotnet"
arguments=".\YourApp.dll"
stdoutLogEnabled="true"
stdoutLogFile=".\logs\stdout"
hostingModel="InProcess">
</aspNetCore>
503 Service Unavailable
Common Causes:
- Application pool stopped or crashed
- Server overloaded or under maintenance
- Resource limits exceeded
Solutions:
- Contact support to restart your application pool
- Check if you're exceeding hosting plan limits
- Review recent code changes that may cause crashes
Quick Diagnostic Steps
| Error | First Check | Likely Cause |
|---|---|---|
| 403 | Does index/default page exist? | Missing default document |
| 500 | Enable detailed errors | Code or config error |
| 502 | Check stdout logs | Application crash |
| 503 | Contact support | App pool stopped |
Important: Remember to disable detailed error messages in production after debugging!