我们的项目在Global.asax的Application_Error里进行异常的全局统一处理,出现异常则记录日志并返回提示的Json,现在本地调试没问题,发布到服务器的IIS上在服务器访问没问题,可是如果在另一台机访问服务器的站点,如果报出异常则直接返回500,换了一台服务器依然如此。请问这排查该如何下手?
解决方案 »
- [向all提问]求一个代码生成器~~~~~~
- 【大虾们,救命啊!!】
- 特简单的问题,希望您指点!
- vs2005中对界面操作是出现了错误,然后vs2005就卡死,寻求帮助
- datagrid怎样实现这样的格式
- 一个关于SQL Server 2000 Reporting报表发布的问题
- window.open("b.aspx")打开b页面后b页面执行pageload吗?
- 自定义detailview中插入发生异常的提示
- VS2003能不能打开05开发的解决方案?
- 为什么连不上自己创建的数据库
- 为什么我的asp:repeater控件在设计的时候能正常显示,但是调试的时候什么都不显示呢?
- 后台怎么获取js给控件加的class值
通过记录日志发现,直到抛出异常上一步依然正常,但没有进入到application_error进行处理,站点用的是state_server,session服务也一切正常
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=device-width" />
<title>错误</title>
</head>
<body>
<hgroup>
<h1>错误。</h1>
<h2>处理你的请求时出错。</h2>
</hgroup>
</body>
</html>
控制面板--防火墙--入站规则--新建规则--选择端口填写完后在试试。
2.看看是否放在根目录上,我有一次也是报错,弄了很久,发现放在根目录就行了,也不知道为什么.
http://stackoverflow.com/questions/6508415/application-error-not-firing-when-customerrors-on
重要的是下面这段:
By default (when a new project is generated), an MVC application has some logic in the Global.asax.cs file. This logic is used for mapping routes and registering filters. By default, it only registers one filter: a HandleErrorAttribute filter. When customErrors are on (or through remote requests when it is set to RemoteOnly), the HandleErrorAttribute tells MVC to look for an Error view and it never calls the Application_Error() method. I couldn't find documentation of this but it is explained in this answer on programmers.stackexchange.com.
所以将Application_Start中的这一句注释掉就行
//FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);