异常错误显示物理路径 [英] Exception error shows physical path

查看:85
本文介绍了异常错误显示物理路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

异常错误显示asp.net实际驻留在开发机器中的物理路径。即使在生产服务器中发布后,异常错误也显示发生了开发的本地文件夹。



所以实际上想要避免错误消息中的本地文件夹驱动器路径。



Asp.net应用程序使用asmx webservices与数据库进行通信。

exception error shows physical path where asp.net actually resides in development machine. Even after publishing in production server the exception error shows local folder where development occurred.

so actually wants avoid that local folder drive path in error message.

Asp.net application uses asmx webservices to communicate with Database.

推荐答案

你必须管理你的错误而不是通过显示错误详细信息,但显示一个错误页面,上面写着发生意外错误,抱歉给您带来不便!。



你可以通过添加来开始这样做/将下一个设置修改为web.config:

You have to manage your errors not by showing the errors details but by displaying an error page with a message like "An unexpected error has occurred, sorry for the inconvenient!".

You can start to do this by adding/modifying the next settings into your web.config:
<customErrors mode="On" />



在我的下一篇文章中 MVC基本站点:第2步 - 例外管理 [ ^ ] ASP.NET MVC应用程序有一些提示和代码框架,但对任何ASP.NET应用程序也都有用。


In my next article MVC Basic Site: Step 2 - Exceptions Management[^] there are some hints and code skeleton for an ASP.NET MVC application but could be useful also for any ASP.NET application.


有几个选项:



1.您可以创建一个全局错误页面并显示常见消息。

2.您可以使用web.config文件使用自定义错误处理此问题。



请按照以下链接了解详情。



http://msdn.microsoft.com/en-us/library/h0hfz6fc(v=vs.85).aspx [ ^ ]



谢谢
There are couple of options:

1. You can create a global error page and show the common message.
2. You can use web.config file to handle this using custom errors.

Follow the below link for detail.

http://msdn.microsoft.com/en-us/library/h0hfz6fc(v=vs.85).aspx[^]

Thanks


这篇关于异常错误显示物理路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆