Troubleshooting HTTP Error Codes (403, 500, 502, 503) Print

  • 0

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:

  1. In Plesk, go to Websites & Domains
  2. Select Hosting Settings
  3. 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:

  1. Check stdout log in the application folder
  2. Verify .NET runtime version is installed
  3. 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:

  1. Contact support to restart your application pool
  2. Check if you're exceeding hosting plan limits
  3. 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!


Was this answer helpful?

« Back