Я использую NBug для отправки отчетов из своего приложения WPF, но я хочу прикрепить к сообщению файл, специфичный для клиента.Вот мой код:
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);
Проблема в том, что я получаю исключение
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)
Есть идеи?Что я делаю не так?
Спасибо