Asp.net mvc 如何更改web.config以提供<;customErrors模式=";关「/&燃气轮机;调试时自动执行

Asp.net mvc 如何更改web.config以提供<;customErrors模式=";关「/&燃气轮机;调试时自动执行,asp.net-mvc,asp.net-mvc-3,asp.net-mvc-4,Asp.net Mvc,Asp.net Mvc 3,Asp.net Mvc 4,在我的Web.Debug.config中,我有以下内容: <system.web> <!-- In the example below, the "Replace" transform will replace the entire <customErrors> section of your Web.config file. Note that because there is only one customErr

在我的Web.Debug.config中,我有以下内容:

  <system.web>
    <!--
      In the example below, the "Replace" transform will replace the entire 
      <customErrors> section of your Web.config file.
      Note that because there is only one customErrors section under the 
      <system.web> node, there is no need to use the "xdt:Locator" attribute.

      <customErrors defaultRedirect="GenericError.htm"
        mode="RemoteOnly" xdt:Transform="Replace">
        <error statusCode="500" redirect="InternalError.htm"/>
      </customErrors>
    -->
  </system.web>

如何更改此选项,使其将配置文件中的值更改为:


将web.config文件中的
更改为

只需将其更改为:

  <customErrors mode="Off" xdt:Transform="Replace">
  </customErrors>

Eonasdan走上了正确的道路

正确的方法是,在调试配置中将错误设置为“Off”

在Web.Release.config中,使用转换:

<customErrors mode="Off" xdt:Transform="Replace">
</customErrors>

这样,当您将代码推送到生产环境时,使用Visual Studio下拉列表中的Web.Release.config文件,转换将替换Web.config文件中的内容