Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
404的ASP.NET自定义错误,其他所有内容的默认值_Asp.net_Asp.net Mvc_Iis_Web Config - Fatal编程技术网

404的ASP.NET自定义错误,其他所有内容的默认值

404的ASP.NET自定义错误,其他所有内容的默认值,asp.net,asp.net-mvc,iis,web-config,Asp.net,Asp.net Mvc,Iis,Web Config,目前我的web.config中有以下内容 <system.web> ... <customErrors mode="On"> <error statusCode="404" redirect="~/404.html" /> </customErrors> ... <system.web> ... ... 但是,我希望在customErrors mode=“Off”时显示错误页面,即默认的

目前我的web.config中有以下内容

<system.web>
    ...
    <customErrors mode="On">
      <error statusCode="404" redirect="~/404.html" />
    </customErrors>
    ...
<system.web>

...
...
但是,我希望在
customErrors mode=“Off”
时显示错误页面,即默认的ASP.NET错误页面,包含完整的异常堆栈跟踪,即使在远程计算机上也是如此。可能吗

是的,这是可能的

默认情况下,IIS将使用errorMode=“DetailedLocalOnly”,我们可以将其设置为

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>       
        <httpErrors errorMode="Detailed" />
    </system.webServer>

使用此答案时,我建议完全删除
,并在
中配置自定义错误页。