如何从 .net 错误对话框发送错误报告?

发布于 2024-10-08 07:32:55 字数 1290 浏览 0 评论 0原文

2008 年,Jeff 写了一篇关于负责任地崩溃的文章。本着这种精神,我尝试在崩溃错误对话框中添加一个“发送错误报告”按钮。这个想法是,用户可以轻松地发送完整的错误报告,其中已经包括版本信息、操作系统信息、堆栈跟踪......这些信息应该放在消息正文或附件文件中。

不幸的是,从 .NET 应用程序发送这样的电子邮件似乎并不简单:

有没有人找到安全可靠的解决方案来做到这一点?

In 2008 Jeff wrote a post on crashing responsibly. In that spirit, I'm trying to add a "send bug report" button to my crash error dialog. The idea is that the user can easily send a full bug report which already includes version information, OS info, stack trace... This information should be put in the message body or in attachment files.

Unfortunately, sending such an email from a .NET application appears to be non-trivial:

  • System.Net.Mail is not what I am looking for: I can't be sure that a connection to an SMTP server can be made in all environments, and I don't want to put the burden of configuring the local SMTP hostname and port on my users. Instead, I just want to launch the existing email software on the system with a precomposed message.
  • Using the OS to open a "mailto:" URL works, but there are annoying restrictions to the amount of data that can be passed this way. Also, it appears that attachments are not really supported by the mailto spec.
  • mapi.dll would probably do what I want as illustrated by this codeproject article, but I read elsewhere that mapi.dll is fundamentally incompatible with .NET causing random crashes.

Has anyone out there found a safe and reliable solution to do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

乱了心跳 2024-10-15 07:32:55

我们通过创建一个简单的 WCF Web 服务解决了这个问题,该服务获取堆栈跟踪、压缩日志等,客户端将其发布到它,然后让 Web 服务服务器发送电子邮件。
这样您就不必在客户端拥有 SMTP 身份验证信息,也不必依赖用户通过其电子邮件客户端提交错误报告。

我们现在甚至通过此 Web 服务定期压缩客户端日志并将其提交到后端服务器,并分析这些日志,以便在客户端问题对客户端造成问题之前抢先检测到它们

We have solved this by creating a simple WCF web service that takes the stack trace, zipped logs etc, which the client posts to it and then let the web service server send the email.
This way you don't have to have the SMTP authentication information on the client side, nor do you have to rely on the user to submit the error report via their email client.

We're now even zipping and submitting client side logs periodically to the backend server via this webservice and analyze those logs to preemptively detect any client side issues before they become problematic to the client

极致的悲 2024-10-15 07:32:55

一种快速方法是设置您的服务器以通过 PHP fe 接收信息。创建一个 ErrorReport.php 并尝试使用包含在 base64 包中的所有信息来调用它。

这“仅”需要端口 80 上的互联网访问,该端口很可能可用。从那里您可以处理信息并将其传递到数据库 fe 中。

A quick way would be to set up your server to receive the information via PHP f.e. . Create an ErrorReport.php and try to call it with every information you have wrapped in a base64 package.

This 'only' needs Internet-Access on Port 80, which is most likely available. From there you can process the information and pass it on into a database f.e. .

佞臣 2024-10-15 07:32:55

您可以 - 当使用您自己的兼容服务器时 - 只需创建一个类似“telnet”的套接字结构即可将数据直接发布到您的服务器中。

像这样的东西:http://www.csharphelp。 com/2007/07/sending-email-with-c-using-smtp/

You could - when using your own compatible server - just create a "telnet" like socket structure to post the data directly into your server.

Something like this: http://www.csharphelp.com/2007/07/sending-email-with-c-using-smtp/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文