法国枫丹白露宫重要文物被盗 包括圆明园珍品
HTTP 404 errors are resolved by verifying file paths, checking virtual directory configurations, and customizing error pages via web.config. 2. HTTP 500 errors require enabling detailed errors, reviewing Event Viewer and Failed Request Tracing logs, validating web.config syntax, and ensuring proper application pool permissions and .NET configuration. 3. HTTP 403 errors are fixed by enabling default documents or directory browsing, configuring IP and domain restrictions, and confirming proper NTFS permissions for the IIS user. 4. HTTP 503 errors are addressed by starting or stabilizing the application pool, adjusting recycling settings, verifying .NET CLR version, and ensuring the app pool identity has adequate privileges. 5. HTTP 401 errors are resolved by configuring appropriate authentication methods in IIS, setting correct NTFS ACLs, and verifying domain connectivity for Windows Authentication. 6. Proactive management includes using custom error pages, monitoring IIS logs, enabling Failed Request Tracing, validating configurations with AppCmd, and ensuring all dependencies like .NET Framework and modules are properly installed and registered, with troubleshooting guided by logs rather than guesswork.
Handling IIS (Internet Information Services) web errors effectively is essential for maintaining a reliable and user-friendly web server. These errors can range from simple configuration issues to deeper application or security problems. Below are common IIS errors and practical steps to diagnose and resolve them.

1. HTTP 404 – Not Found
This error occurs when the requested page or resource doesn’t exist on the server.
Common causes:

- Incorrect URL or broken links
- Missing files or misconfigured virtual directories
- URL Rewrite rules redirecting incorrectly
How to fix:
- Verify the file exists in the correct directory under the site root.
- Check if the requested page has been moved or renamed.
- Ensure virtual directories or applications are configured properly in IIS Manager.
- Use IIS Failed Request Tracing to see which path was attempted.
- Customize the 404 error page to guide users back (via
web.config
):
<configuration> <system.webServer> <httpErrors errorMode="Custom"> <remove statusCode="404" /> <error statusCode="404" path="/errors/404.html" responseMode="ExecuteURL" /> </httpErrors> </system.webServer> </configuration>
2. HTTP 500 – Internal Server Error
A generic server-side error indicating something went wrong during processing.

Common causes:
- Misconfigured
web.config
- Application pool crashes
- Permission issues
- .NET runtime errors
How to troubleshoot:
- Enable Detailed Errors in IIS:
- In IIS Manager → select site → Error Pages → Edit Feature Settings → choose "Detailed errors".
- Check Event Viewer (Windows Logs → Application) for ASP.NET or IIS-related errors.
- Enable Failed Request Tracing:
- In IIS Manager → Failed Request Tracing Rules → Add a rule for status code 500.
- Review the generated XML logs in
C:\inetpub\logs\FailedReqLogFiles
.
- Validate
web.config
syntax (especially<system.webServer>
and<handlers>
sections). - Ensure the Application Pool identity has proper permissions to access files and databases.
- If using ASP.NET, check
customErrors
mode:
<system.web> <customErrors mode="Off" /> </system.web>
3. HTTP 403 – Forbidden
Access is denied, even though the server is reachable.
Common variations:
- 403.14 – Directory browsing is disabled and no default document is found.
- 403.6 – IP address rejected.
- 403.7 – Client certificate required.
Solutions:
- For 403.14:
- Enable directory browsing (not recommended for production) or
- Add default documents (e.g.,
index.html
,default.aspx
) in IIS → Default Document.
- For 403.6 / 403.7:
- Check IP Address and Domain Restrictions in IIS.
- Ensure client certificates are properly configured if required.
- Confirm the IIS user (e.g.,
IIS_IUSRS
) has read (and execute) permissions on the site folder.
4. HTTP 503 – Service Unavailable
The server is temporarily unable to handle the request, often due to the application pool being stopped.
Most common cause:
- Application Pool is stopped or crashing.
Steps to resolve:
- Open IIS Manager → Application Pools → check if the pool is Started.
- If it keeps stopping:
- Check Event Viewer for .NET errors, memory leaks, or recycling issues.
- Adjust application pool recycling settings (e.g., disable rapid-fail protection temporarily).
- Set the application pool identity to a user with proper privileges (e.g.,
ApplicationPoolIdentity
is usually sufficient). - Ensure the app pool is set to the correct .NET CLR version (e.g., v4.0 for modern apps).
- Test by manually starting the pool and accessing the site.
5. HTTP 401 – Unauthorized
Authentication failed or required credentials weren't provided.
Common subcodes:
- 401.1 – Logon failed
- 401.2 – Authentication failed due to server configuration
- 401.3 – Access denied due to ACLs
How to fix:
- Check Authentication settings in IIS:
- For public sites: Enable Anonymous Authentication, disable others.
- For intranet: Enable Windows Authentication.
- Ensure the anonymous user (usually
IIS_IUSRS
) has proper NTFS permissions. - If using Windows Auth, verify domain connectivity and user access rights.
- For 401.3, review file/folder ACLs — ensure the app pool identity can read the content.
6. Other Tips for Proactive Error Management
Use Custom Error Pages: Provide user-friendly messages without exposing server details.
Monitor Logs Regularly: IIS logs are located by default in
%SystemDrive%\inetpub\logs\LogFiles
. Use tools like LogParser or ELK stack for analysis.Enable Failed Request Tracing: Helps capture detailed info on requests that result in errors (especially 4xx and 5xx).
Validate Configuration with AppCmd: Use command-line tool to test config:
%windir%\system32\inetsrv\appcmd validate config
Check Dependencies: Ensure .NET Framework, ASP.NET registration (
aspnet_regiis.exe
), and required modules are installed.
Handling IIS errors efficiently comes down to enabling proper logging, understanding HTTP status codes, and systematically checking configuration, permissions, and application health. Most issues can be resolved by combining IIS Manager, Event Viewer, and failed request logs.
Basically, don’t guess — trace the request and let the logs guide you.
The above is the detailed content of How to handle various IIS web errors?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

To limit the size of client requests, the maxAllowedContentLength parameter can be modified in web.config, such as setting it to 104857600 (100MB), and synchronizing the maxRequestLength of ASP.NET at the same time; to reasonably set the connection timeout time, it can be modified through the IIS manager or appcmd.exe command, with the default of 120 seconds, and the API scenario is recommended to set it to 30-90 seconds; if the request queue is full, you can increase MaxClientConn and QueueLength, optimize application performance, and enable load balancing to relieve stress.

Configuring HTTP response headers in IIS to optimize cache and improve security can be achieved by setting cache-related headers and adding security response headers. 1. Set cache-related headers: By configuring the clientCache element in the web.config file, set the Cache-Control and Expires headers for static resources, for example, use cacheControlMaxAge to specify the cache time, and fine-grained control can also be performed for specific file types (such as .jpg), but avoid HTML page caching for too long. 2. Add security-related headers: Configure X-Content-Type-Optio through customHeaders in web.config

ToenableandcustomizedirectorybrowsinginIIS,firstinstallandenabletheDirectoryBrowsingfeatureviaServerManagerandIISManager;next,customizetheappearanceusingheaderandfooterHTMLsnippets;thenconfiguredefaultdocumentstopreventunintendeddirectorylistings;fin

VirtualdirectoriesandapplicationsinIISdifferinindependenceandconfiguration.1.Virtualdirectoriesactasaliasestoexternalcontent,sharingtheparentsite’sapplicationpoolandconfiguration,idealfororganizingstaticfileswithoutduplication.2.Applicationsrunindepe

SharedconfigurationinIISallowsmultipleserverstouseacentralizedapplicationHost.configfile,ensuringconsistencyacrossawebfarm.1.Itenablesallserverstopointtoasharedconfigurationlocation.2.SetupinvolvesusingaUNCpath,enablingthefeatureinIISManager,andimpor

Windows authentication is suitable for internal applications and is automatically authenticated through domain accounts; the steps are to open IIS Manager, select a site, enable Windows authentication, and ensure HTTPS is used. Forms authentication is suitable for custom login pages. You need to configure the login URL and timeout time in web.config, and develop a login page to verify users, encrypt your password and use HTTPS. Basic authentication is lightweight but not secure. It is only used when HTTPS is enabled. It needs to be enabled in IIS and cooperate with local or domain accounts. Password leakage is often caused by ignoring HTTPS.

MIME type is a mechanism by which the server identifies file content types, and missing or incorrect configuration can cause resource loading to fail. There are two main ways to manage MIME types with specific extensions in IIS: 1. Add or modify them through the IIS manager graphical interface; 2. Configure in the web.config file. Common MIME types that need to be added manually include .webmanifest, .woff2, .svg, .mp4 and .pdf. Notes include inheritance issues, IIS version differences and browser cache impact. Proper configuration is essential to ensure that modern web resources are loading properly.

appcmd.exe is a command line tool that comes with IIS7 and above, which can be used to efficiently manage IIS. 1. Can be used to manage sites and applications, such as starting and stopping sites (such as appcmdstopsite/site.name:"MySite"), list running sites, and add or delete applications. 2. Configurable application pools, including creating (appcmdaddapppool/name:MyAppPool), setting .NETCLR version (appcmdsetapppool/apppool.name:MyAppPool/managedRuntimeVersion:v4
