9

是否有您建议在.net 中使用的错误报告框架。我需要像电子邮件报告这样的可能性,文件附加到电子邮件。用户应该可以将信息添加到报告中,也应该可以删除报告文件,即如果它们包含隐私关键数据。还应该有可能进行自动屏幕截图。所需的框架还应该包括错误报告 gui。它应该让我有可能为错误报告创建自己的 gui。

我已经使用log4net,但据我所知,不可能向用户显示用于错误报告的 gui。

如果有什么建议就好了

问候,马丁

4

9 回答 9

5

你试过Elmah吗?它执行您所说的所有错误处理元素。您可能会查看Trac以获取所需的错误修复位。

善良,

于 2009-12-15T08:43:38.493 回答
4

我熟悉“Microsoft Enterprise Library Logging Block”和“Log4Net”,这两个都符合您的要求(有多个日志侦听器)这是一个比较这两个的页面:http ://weblogs.asp.net/lorenh /archive/2005/02/18/376191.aspx

于 2009-12-15T08:47:12.900 回答
4

滚动您自己的异常处理程序。在您的 program.cs 类中使用以下代码。发生异常时会自动发送邮件。

using System;
using System.Windows.Forms;
using System.Net;
using System.Net.Mail;
using System.Threading; 

namespace ExceptionHandlerTest
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.ThreadException +=
                new ThreadExceptionEventHandler(Application_ThreadException);

            // Your designer generated commands.
        }

        static void Application_ThreadException(object sender, ThreadExceptionEventArgs e) 
        {

            var fromAddress = new MailAddress("your Gmail address", "Your name");
            var toAddress = new MailAddress("email address where you want to receive reports", "Your name");
            const string fromPassword = "your password";
            const string subject = "exception report";
            Exception exception = e.Exception;
            string body = exception.Message + "\n" + exception.Data + "\n" + exception.StackTrace + "\n" + exception.Source;

            var smtp = new SmtpClient
            {
                Host = "smtp.gmail.com",
                Port = 587,
                EnableSsl = true,
                DeliveryMethod = SmtpDeliveryMethod.Network,
                UseDefaultCredentials = false,
                Credentials = new NetworkCredential(fromAddress.Address, fromPassword)
            };
            using (var message = new MailMessage(fromAddress, toAddress)
            {
                Subject = subject,
                Body = body
            })
            {
                //You can also use SendAsync method instead of Send so your application begin invoking instead of waiting for send mail to complete. SendAsync(MailMessage, Object) :- Sends the specified e-mail message to an SMTP server for delivery. This method does not block the calling thread and allows the caller to pass an object to the method that is invoked when the operation completes. 
                smtp.Send(message);
            }
        }
    }
}
于 2012-05-15T09:35:50.530 回答
3

查看The Object Guy制作的日志框架

于 2009-12-15T08:53:43.790 回答
3

Red Gate 有一个名为SmartAssembly的产品,可以进行错误报告。我自己没用过,但是公司口碑不错。

于 2010-08-02T01:13:28.520 回答
1

检查Enterprise Library,您有一个完全可配置和可扩展的日志记录和异常处理应用程序日志。

于 2009-12-15T08:45:54.530 回答
1

Microsoft WER,但是您需要在 Winqual 注册,并且您的公司需要拥有 VeriSign ID。对很多人来说太麻烦了。

于 2009-12-15T08:47:32.093 回答
0

Microsoft 的Enterprise Library最新版本4.1-October 2008广泛用于异常处理和日志记录等。还有一个不错的 GUI 构建器,可以修改您的 app.config 或 web.config 文件。

于 2009-12-15T08:48:16.237 回答
0

您也可以尝试log4net。不过,我不确定是否要发送电子邮件。但是,它是可扩展的。另外,您可以获得源代码!

于 2010-02-09T09:09:49.103 回答