部署时出错

时间:2009-09-14 14:30:02

标签: asp.net iis deployment web-config

部署Web应用程序时出现以下错误

Server Error in '/FormRelease' Application.
--------------------------------------------------------------------------------

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

请帮助我!

1 个答案:

答案 0 :(得分:0)

为了避免看到像您发布的那样无用的错误消息,我使用了错误日志数据库表和其他异常处理程序。通常,当发生异常时,我会捕获错误,将错误写入错误日志,然后重新加载它以让系统进一步处理它。然后,当我收到像这样的错误时,我可以检查错误日志中是否存在可能的异常。

在这种情况下,我怀疑这是一个配置错误。因此系统可能甚至无法进入您的代码,或者异常处理本身也可能会失败,原因很简单,因为它无法连接到数据库。

可能的原因:没有对数据库的访问权限,缺少模块,配置无效,访问权限不足,路由错误,未在IIS中设置的应用程序以及许多其他可能性。要解决这些错误并防止在生产环境中发生这种情况,请始终先部署到测试环境,以便检查是否存在任何错误和其他问题。

正如Joel Coehoorn评论的那样,首先调整web.config。但另外,首先将Web应用程序部署到本地,干净的测试环境中!然后,您可以更轻松地检查任何问题,而不会打扰生产环境。 (如果您买不起第二个测试系统,请使用虚拟机。)