首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何将附加文件附加到NBug

如何将附加文件附加到NBug
EN

Stack Overflow用户
提问于 2018-05-15 16:35:30
回答 1查看 128关注 0票数 1

我使用NBug从我的WPF应用程序发送报告,但我想在电子邮件中附加一个特定于客户端的文件。下面是我的代码:

代码语言:javascript
复制
   AppDomain.CurrentDomain.UnhandledException += NBug.Handler.UnhandledException;
   Application.Current.DispatcherUnhandledException += NBug.Handler.DispatcherUnhandledException;
   if (!File.Exists(AppDomain.CurrentDomain.BaseDirectory))
   {
       var stream = File.Create(AppDomain.CurrentDomain.BaseDirectory + FileNames.FILE_NAME_MACHINE_INFO);                
       stream.Close();
       TextWriter tw = new StreamWriter(AppDomain.CurrentDomain.BaseDirectory + FileNames.FILE_NAME_MACHINE_INFO);
       tw.WriteLine("The very first line!");
       tw.Close();
    }
    NBug.Settings.AdditionalReportFiles.Add(AppDomain.CurrentDomain.BaseDirectory + FileNames.FILE_NAME_MACHINE_INFO);

问题是,我得到了一个异常

代码语言:javascript
复制
NBugError: An exception occurred while submitting bug report with Mail. Check the inner exception for details.
Exception: System.Net.Mail.SmtpException: Failure sending mail. ---> System.IO.IOException: Unable to write data to the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
   at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size)
   --- End of inner exception stack trace ---
   at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size)
   at System.Net.Security._SslStream.StartWriting(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
   at System.Net.Security._SslStream.ProcessWrite(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
   at System.Net.TlsStream.Write(Byte[] buffer, Int32 offset, Int32 size)
   at System.Net.Mime.EightBitStream.Write(Byte[] buffer, Int32 offset, Int32 count)
   at System.Net.Base64Stream.FlushInternal()
   at System.Net.Base64Stream.Close()
   at System.Net.Mime.MimePart.Send(BaseWriter writer, Boolean allowUnicode)
   at System.Net.Mime.MimeMultiPart.Send(BaseWriter writer, Boolean allowUnicode)
   at System.Net.Mail.SmtpClient.Send(MailMessage message)
   --- End of inner exception stack trace ---
   at System.Net.Mail.SmtpClient.Send(MailMessage message)
   at NBug.Core.Submission.Web.Mail.Send(String fileName, Stream file, Report report, SerializableException exception)
   at NBug.Core.Submission.Dispatcher.EnumerateDestinations(Stream reportFile, ExceptionData exceptionData)

有什么想法吗?我做错了什么?

谢谢

EN

回答 1

Stack Overflow用户

发布于 2018-05-15 19:48:20

我找到了答案。我将MiniDump类型设置为Full,.zip文件变得超过100MB,你不能用gmail发送这么大的文件。当我将MinDump类型设置为Tiny时,问题就解决了

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50345733

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档