2010-01-06 78 views
1

我们将我们的网站托管在IIS 7.0和集成模式下,我们已经设置了如下的自定义错误页面。自定义错误页面不起作用IIS 7.0 - 它显示错误错误页面

<customErrors defaultRedirect="Error.htm" mode="On"> 
     <error statusCode="404" redirect="Error.htm"/> 
    </customErrors> 

它重定向从错误页的URL像下面的,但它不是显示URL http://www.abc.com/Error.htm?aspxerrorpath=/and其显示以下错误:

Runtime Error

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 tag within a "web.config" configuration file located in the root directory of the current web application. This 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 configuration tag to point to a custom error page URL.

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

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

defaultRedirect="mycustompage.htm"/>

+0

什么是你得到的错误(你应该看到它在应用程序事件日志中)?如果错误与web.config文件相关,或者在网站初始化时发生错误,则可能还不能识别自定义错误页面配置设置。发布例外细节可以帮助我们弄清楚是否属于这种情况。 – Jacob 2010-01-06 09:31:39

+0

它很简单,如果你把错误的连接字符串,那么它应该显示错误页面,但它的显示页面已经写成如上 – 2010-01-06 15:32:35

回答

3

您可能需要使用<httpErrors>元素<system.webServer>这是为IIS 7等

奇怪的是,它是从IIS的开发版本不同。也许如果您使用IIS Express进行开发,它应该更密切地匹配IIS 7的行为。

1

你确实有mode="Off"在你提供的XML片段。是否将其更改为mode="On"

+0

它已经在活服务器上。这是输入错误 – 2010-01-06 09:10:04

0

已经有一个选定的解决方案。我只是想多做点贡献。

再就是看看你的Machine.config 文件Ç发现:\ WINDOWS \ Microsoft.NET \框架{版本} \配置C:\ WINDOWS \ Microsoft.NET \ Framework64 {version} \ Config

请确定您有。

<deployment retail="false"/>