Home > Software design >  HTTP Error 404.0 (Error Code 0x80070002) - IIS 10, .NET 4.0
HTTP Error 404.0 (Error Code 0x80070002) - IIS 10, .NET 4.0

Time:03-28

I have an issue with my default error page. Currently, it keeps displaying the following error. The custom error HTML page file is in the same folder as the web.config, I have tried changing the directory of the error page HTML but the results were the same. However, what confuses me is the fact that I was able to run the error page on another local server, but I wasn't able to get the HTML error page on the server with the web.config configurations.

I have tried the following changes to my web.config file. However, none of them worked.

Added to web.config the following codes:

<modules runAllManagedModulesForAllRequests="true">
<validation validateIntegratedModeConfiguration="false" />
 <remove name="UrlRoutingModule"/>

Attached is the error code and the configurations image I have. (I removed the following configurations as mentioned above as they did not work) Please do leave your suggestions and tips, thank you!

Error Code

CodePudding user response:

The reason why the custom error page is not displayed is because an error occurred during the request process, so you need to resolve the 404.0 error first.

There are many reasons for this error, you can try the following methods to solve the problem:

  1. Changing the Application Pool from Classic to Integrated.

  2. Edit the .html handler in IIS to use ASP.NET, you can find it in the website properties under the home directory tab in app configuration in the mappings section in IIS.

    C:\windows\microsoft.net\framework\v4.0.30319\aspnet_isapi.dll

enter image description here

CodePudding user response:

I had dug deeper and realized that my code was wrong. I tried using the httpsError attribute errorMode= "DetailedLocalOnly" which resulted in this error. The correct value for this attribute should be errorMode= "Custom"

My bad for not checking the code thoroughly. More information about the attribute can be found here https://docs.microsoft.com/en-us/iis/configuration/system.webserver/httperrors/

Thank you all.

  • Related