ELMAH 错误和经典 Asp
我们已经在我们拥有的 ASP.NET MVC 网站上使用 ELMAH 进行错误日志记录...但我们的主网站仍然是经典的 asp,我已经开始为该网站创建错误处理/日志记录结构,但我认为它如果我们能够在所有应用程序中保持错误日志记录的一致性,那就太好了。我想使用相同的数据库结构......甚至可能将来自不同源应用程序的错误存储在同一个表中,然后按源进行过滤。我想也许我可以从我们的经典 asp vb 服务器代码中调用 ELMAH dll 来记录错误信息。我浏览了 ELMAH 网站...然后我浏览了 AIRBRAKE - http://airbrake.io /pages/home - 但无法真正了解它会如何或如何从经典的 asp 网页完成。
如果有人对此有任何经验或有任何有帮助的建议,我将不胜感激......谢谢。
We're already using ELMAH for error logging on an ASP.NET MVC website that we have ... but our main website is still classic asp and I've begun creating an error handling/ logging structure for that website, but I thought it would be great if we could keep the error logging consistent across all our applications. I'd like to use the same database structure ... perhaps even store the errors from different source applications in the same table and then filter by source. I thought maybe that I could call out to the ELMAH dll from our classic asp vb server code to log the error information. I took a look at the ELMAH website ... and then I took a look at AIRBRAKE - http://airbrake.io/pages/home - but couldn't really see how it would be or could be done from a classic asp web page.
If anyone has any experience with this or has any suggestions that would be helpful I'd appreciate it ... thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
受到比尔·马丁的回答的启发,我整理了一个概念验证来证明这一点。有一个经典的 ASP 处理程序调用
Server.GetLastError()
,将结果编码为 JSON 并将其 POST 到 .NET HttpHandler,然后该处理程序将其与所有常规 .NET 错误一起记录到 ELMAH。代码和注释位于 https://github.com/dylanbeattie/ElmahASP
Inspired by Bill Martin's answer, I've put together a proof-of-concept that demonstrates this working. There's a classic ASP handler that calls
Server.GetLastError()
, encodes the result as JSON and POSTs it to a .NET HttpHandler, which then logs it to ELMAH alongside all the regular .NET errors.The code and notes are at https://github.com/dylanbeattie/ElmahASP
根据您计划使用经典 asp 的时间,一种选择是创建一个临时 .Net 站点,启用 elmah 来捕获经典 asp 错误。您的经典 ASP 站点会通过帖子或其他方式向该站点发送错误,并使用安全性来防止不需要的帖子。您需要解析发送的数据并手动调用 elmah 来记录错误。
然后,当您升级时,使用相同的设置,您的日志记录将在两个版本之间无缝进行。
Depending on how long you plan to stay on classic asp, one option would be to create a temporary .Net site that has elmah enabled for trapping classic asp errors. Your classic ASP site would send this site the errors by means of a post or something, using security to prevent unwanted posts. You would need to parse the data sent and manually call elmah to log the error.
Then, when you upgrade, use the same settings and your logging will be seamless between the 2 versions.