【问题标题】:Global.asax is not publishing and event are not firing in Global.asaxGlobal.asax 未发布且事件未在 Global.asax 中触发
【发布时间】:2012-10-15 05:59:30
【问题描述】:

我正在开发 ASP.NET Web 应用程序,对于未处理的异常,我正在使用 Global.asax 文件 我在其中编写了一个逻辑来将错误日志写为

Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)

        'Code that runs when an unhandled error occurs

End Sub

这一切都在本地工作,但发布时网站 global.asax 未发布 我仍然将 global.asax 上传到远程服务器,但事件没有触发 我的应用程序使用 IIS 7 作为 Web 服务器

我是否需要任何类型的配置建议您是否有任何解决方案

【问题讨论】:

  • 您能否展示一下您在 web.config 上为错误处理设置的内容?
  • web.config 是 .net 4.0 默认生成的。我只添加了连接字符串,没有别的
  • 那么,<customErrors 上有什么?
  • 您发布的 iis 版本是什么?

标签: asp.net global-asax


【解决方案1】:

我还上传了 App_global.asax.compiled 并且可以正常工作

【讨论】:

  • 我也有同样的问题。你能详细说明吗?您从哪里获得文件以及从哪里上传的?
【解决方案2】:

我们尝试了很多东西。

  1. global.asax works on local computer but not after i publish to server
  2. Why are the Global.asax events not firing in my ASP .NET website?
  3. Global.asax not firing for Release build
  4. Mystery of Global.asax in ASP.NET MVC application

我们还尝试将以下文件放在rootbin 目录中。

  1. App_global.asax.dllApp_global.asax.compiled 文件
  2. PrecompiledApp.config

都没有用!

为了触发全局事件,对于我们的 asp.net 2.0 网站,我们必须使用原始的 Global.asax 而不是 pre-compiled dll。

希望这对某人有所帮助!干杯!快乐编码! :D

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-12
    • 2011-01-02
    • 2011-11-01
    • 1970-01-01
    相关资源
    最近更新 更多