仅在MVC

时间:2016-11-04 06:29:32

标签: asp.net-mvc web-config

当我调试我的mvc web应用程序时,会打开一个错误窗口而不是我的登录页面,错误就像

    To enable the details of this specific error message to be viewable on the local server machine, 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 "RemoteOnly". To enable the details to be viewable on remote machines, please set "mode" to "Off".

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

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

注意:您看到的当前错误页面可以通过修改&#34; defaultRedirect&#34;来替换为自定义错误页面。应用程序的配置标记的属性指向自定义错误页面URL。

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

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

任何人都可以帮助我吗?

1 个答案:

答案 0 :(得分:0)

这里有一个潜在的问题,需要先解决才能进入登录页面,但首先你需要在登录网络服务器时浏览你的应用程序,或者更新网页。配置文件,使其如下所示:

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

完成此操作后,您至少应该收到实际的错误消息。另见