Jed
Jed

Reputation: 21

HTTP Error 404.0 (Error Code 0x80070002) - IIS 10, .NET 4.0

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

Upvotes: -1

Views: 17909

Answers (3)

Jed
Jed

Reputation: 21

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"

More information about the attribute can be found here https://learn.microsoft.com/en-us/iis/configuration/system.webserver/httperrors/

Upvotes: 1

LFarias
LFarias

Reputation: 21

Try removing and adding the service back in IIS. It worked for me. It might be an incorrect path for the service the cause for this error.

Upvotes: 1

samwu
samwu

Reputation: 5195

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

Upvotes: 0

Related Questions