ASP.NET本地调试通过,服务器上出错,解决办法

来源:百度知道 编辑:UC知道 时间:2024/06/23 07:39:28
我在本地上调试通过了网站,没有问题,但是放到服务器上时,网站就出现了问题:
Server Error in '/' 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

出现这种问题的原因有很多,毕竟本地调试和服务器的环境不一样,可能是权限问题,也可能是代码问题,因为iis不是所有的功能都支持的,得需要配置,你可以在Global.asax中把异常信息写到日志里或者设定出错页

首先可能是权限的问题,
然后可能是数据库链接错了,你仔细看一下,毕竟服务器端和本地是有很大的差别。
我最近也出现了这样的情况,把web.config里面的中文注释全删掉就好了。

希望对你有用!

在webconfig文件中把<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>

改成

<customErrors mode="Off" />

然后打开页面,会显示详细的错误信息。