HTTP 错误 404.0(错误代码 0x80070002)- IIS 10、.NET 4.0
我的默认错误页面有问题。目前,它一直显示以下错误。 自定义错误HTML页面文件与web.config位于同一文件夹中,我尝试更改错误页面HTML的目录,但结果是相同的。 然而,令我困惑的是,我能够在另一台本地服务器上运行错误页面,但无法使用 web.config 配置在服务器上获取 HTML 错误页面。
我已尝试对 web.config 文件进行以下更改。然而,它们都不起作用。
添加到 web.config 以下代码:
<modules runAllManagedModulesForAllRequests="true">
<validation validateIntegratedModeConfiguration="false" />
<remove name="UrlRoutingModule"/>
附件是错误代码和我的配置图像。 (我删除了上面提到的以下配置,因为它们不起作用)请留下您的建议和提示,谢谢!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试在 IIS 中删除并添加该服务。这对我有用。导致此错误的原因可能是服务路径不正确。
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.
我更深入地挖掘并意识到我的代码是错误的。我尝试使用 httpsError 属性
errorMode= "DetailedLocalOnly"
导致此错误。此属性的正确值应为
errorMode= "Custom"
有关该属性的更多信息,请参阅此处 https://learn.microsoft.com/en-us/iis/configuration/system.webserver/httperrors/
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/
自定义错误页面不显示的原因是请求过程中出现错误,需要先解决404.0错误。
导致此错误的原因有很多,您可以尝试以下方法来解决问题:
将应用程序池从
Classic
更改为Integrated
。在 IIS 中编辑 .html 处理程序以使用 ASP.NET,您可以在 IIS 映射部分的应用程序配置的主目录选项卡下的网站属性中找到它。
C:\windows\microsoft.net\framework\v4.0.30319\aspnet_isapi.dll
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:
Changing the Application Pool from
Classic
toIntegrated
.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