web.config 忽略 customerrors=“on”属性
您好,我有一个网站,可以看到经典的内容:
“/”应用程序中的服务器错误。
运行时错误
描述:服务器上发生应用程序错误。此应用程序的当前自定义错误设置阻止远程查看应用程序错误的详细信息(出于安全原因)。但是,它可以通过本地服务器计算机上运行的浏览器查看。
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>
问题是,虽然我将 CustomErrors 更改为 On,但我看不到该错误,并且 web.config 的 xml 没有格式错误,因为我尝试引发此错误并且 IIS 告诉我,所以一定是别的东西,但是我应该寻找什么?
编辑 我应该提到,我只在发布网站时收到此错误,web.config 不会在本地返回错误,只有当我上传到生产环境时才会出现此错误。我什至无法显示 html 页面,它仍然向我返回 Web 配置错误
Hi I've got a site where I get the classic:
Server Error in '/' Application.
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>
The problem is that although I change CustomErrors to On I can't see the error, and the xml of the web.config is not malformed since I've tried inducing this error and IIS told me, so it must be something else, but what should I look for?
Edit
I Should mention, that I only get this error when I publish my site, web.config doesn't return an error locally, only when I upload to production. I can't even get an html page to display, it still returns the web config error to me
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您使用 web.config,那么我假设您有一个 ASP.Net 应用程序。 web.config 存储 .NET 应用程序的配置数据。如果您不在虚拟目录中创建应用程序,那么您将看到错误,因为没有可供 IIS 提供服务的应用程序。此链接应该有所帮助。
If your using a web.config then I am assuming that you have an ASP.Net application. The web.config stores configurational data for a .NET application. If you don't create an application within your virtual directory then you will see the error you are because there is no application for IIS to serve. This link should help.