asp.net - 即使使用customErrors ="Off"(在ubuntu/mono上),Web.config也不显示远程错误。

标签 asp.net mono web-config custom-errors

这是我的Web.config文件:

<?xml version="1.0"?>
<configuration>
    <system.web>
        <customErrors mode="Off" />    
        <compilation debug="true" strict="false" explicit="true />    
        <pages>
          <namespaces>
            <clear />
            <add namespace="System" />
            <add namespace="System.Collections" />
            <add namespace="System.Collections.Generic" />
            <add namespace="System.Collections.Specialized" />
            <add namespace="System.Configuration" />
            <add namespace="System.Text" />
            <add namespace="System.Text.RegularExpressions" />
            <add namespace="System.Web" />
            <add namespace="System.Web.Caching" />
            <add namespace="System.Web.SessionState" />
            <add namespace="System.Web.Security" />
            <add namespace="System.Web.Profile" />
            <add namespace="System.Web.UI" />
            <add namespace="System.Web.UI.WebControls" />
            <add namespace="System.Web.UI.WebControls.WebParts" />
            <add namespace="System.Web.UI.HtmlControls" />
          </namespaces>
          <controls>
            <add src ="~/controls/maleBed.ascx" tagPrefix ="mycontrol" tagName ="male"/>
            <add src ="~/controls/femaleBed.ascx" tagPrefix ="mycontrol" tagName ="female"/>
          </controls>
        </pages>
    </system.web>
</configuration>

即使将customErrors模式设置为Off(并且绝对是大写的“O”),它仍会向我显示默认错误页面,告诉我设置此属性,然后才能远程看到实际错误。

我没有machine.config文件,并且还在Web.Debug.config和Web.Release.config中将此customErrors mode =“Off”设置了。

有任何想法吗?

非常感谢你。

编辑-其显示内容:
Server Error in '/' Application

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.

Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".

<!-- Web.Config Configuration File -->

<configuration>
    <system.web>
        <customErrors mode="Off"/>
    </system.web>
</configuration>


Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.

<!-- Web.Config Configuration File -->

<configuration>
    <system.web>
        <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
    </system.web>
</configuration>

最佳答案

线

<compilation debug="true" strict="false" explicit="true />

在您的代码中是错误的。这里是更正:(请参见最后一个引号)
<compilation debug="true" strict="false" explicit="true" />

关于asp.net - 即使使用customErrors ="Off"(在ubuntu/mono上),Web.config也不显示远程错误。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5043339/

相关文章:

c# - 存储多个文本体的最佳位置在哪里(没有数据库)

c# - ASP.NET json.Net xml转json

linux - F#、Linux 和 makefile

c# - 单击链接按钮时清除复选框列表选择(尽管回发检查)

asp.net - web.config 转换和位置元素

c# - 从 web api 调用 aspx 页面时出现“无效的 URI : The format of the URI could not be determined.”

asp.net - 下拉列表框中的日期

c# - DMCS 中的 D 代表什么?

asp.net - 如何加密 ASP.NET 4.0 Web.Config?

asp.net-web-api - Blazor 项目的 app.config 解决方案是什么?