8

Here is my Web.config file:

<?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>

Even with customErrors mode set to Off (and its definitely a capital "O") its still showing me the default errors page telling me to set this property before I can see that actual error remotely.

I don't have a machine.config file, and I've also set this customErrors mode="Off" in the Web.Debug.config and the Web.Release.config.

Any ideas anyone?

Thank you very much.

Edit - what its showing:

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>
4

6 回答 6

6

线

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

在您的代码中是错误的。这里更正:(见最后一个引号)

<compilation debug="true" strict="false" explicit="true" />
于 2012-02-15T09:10:58.723 回答
5

找不到答案 - 我们必须获得基于 Windows 的主机。

于 2011-08-22T08:19:54.713 回答
5

我发现在更改 web.config 文件后我实际上必须重新启动 apache ......

于 2011-08-22T03:13:00.287 回答
3

这些设置对我来说是正确的。

您确定您正在查看正确的 web.config 文件吗?您是否在页面指令中覆盖了这些值中的任何一个?

考虑发布您的整个 web.config(没有私人信息)。

编辑:另外,当您查看页面时它显示什么?

于 2011-02-18T15:51:59.887 回答
0

尽管过去 2 天我对 Mono 感到非常沮丧,并考虑自己获得 Windows 托管,但我发现至少对于 MVC 4 网站,为了获得详细的错误,您必须进入Views并找到Web.config那里并添加所需的指令<customErrors mode="Off"/>.

将其添加到主目录中的 Web.config 不会改变任何事情。

然后真正的麻烦开始了。

于 2013-11-10T10:30:56.347 回答
0

我确实有一些问题。我对linux也很陌生。就我而言,问题是我没有向站点文件夹添加所需的权限,结果甚至没有读取 Web.config。

仅出于调试目的,您可以尝试允许对整个站点文件夹的所有权限(递归)。

  • chmod -R ugo+rwx /your_site_root

但不建议使用此类权限进行生产。

于 2016-05-19T12:41:58.020 回答