| Author |  | 
      
        | shaokao Newbie
 
  
  
 Joined: 08 May 2008
 Location: China
 Online Status: Offline
 Posts: 9
 | 
          when i try to use log in multithread with multi smtp instance,it throws some exception
           | Posted: 10 May 2008 at 3:45am | IP Logged |   |  
           | 
 |  
 
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Alex AfterLogic Support
 
  
  
 Joined: 19 November 2003
 Online Status: Offline
 Posts: 2207
 | 
          What is the name of the exception? Maybe, your server does not allow multiple simultaneous connections from the same IP address.
           | Posted: 10 May 2008 at 4:26am | IP Logged |   |  
           | 
 |  
 Regards,
 Alex
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | shaokao Newbie
 
  
  
 Joined: 08 May 2008
 Location: China
 Online Status: Offline
 Posts: 9
 | 
          MailBee.MailBeeIOException: IOException occurred. InnerException message follows:  文件“D:\Work\MailPolicy\FundEmail.Server.MailPol icy\bin\Debug\log.txt”正由另一 7;程使用,因此该 36827;程无法访问该ਧ 1;件。 ---> System.IO.IOException:  文件“D:\Work\MailPolicy\FundEmail.Server.MailPol icy\bin\Debug\log.txt”正由另一 7;程使用,因此该 36827;程无法访问该ਧ 1;件。
           | Posted: 12 May 2008 at 11:51pm | IP Logged |   |  
           | 
 |  在 System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
 在 System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
 在 System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
 在 System.IO.StreamWriter.CreateFile(String path, Boolean append)
 在 System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize)
 在 System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding)
 在 MailBee.Logger.a(Boolean A_0)
 ---  内部异常堆栈跟$ 394;的结尾 ---
 在 MailBee.Logger.a(Boolean A_0)
 在 MailBee.Logger.b(String A_0, String A_1, LogMessageType A_2, ec A_3)
 在 a3.a(MailMessage A_0, String A_1, EmailAddressCollection A_2, DeliveryNotificationOptions A_3, Smtp8bitDataConversion A_4, Boolean A_5, SendFailureThreshold A_6, Int32 A_7, be A_8, Boolean A_9, DataTable A_10, Int32 A_11, String A_12)
 在 er.a(String A_0, EmailAddressCollection A_1)
 在 er.a(Boolean A_0, String A_1, EmailAddressCollection A_2)
 [16:10:13] any||2:MailBee.MailBeeInvalidArgumentException: At least one DNS or SMTP server must be specified in order to send mail.
 在 a3.a(MailMessage A_0, String A_1, EmailAddressCollection A_2, DeliveryNotificationOptions A_3, Smtp8bitDataConversion A_4, Boolean A_5, SendFailureThreshold A_6, Int32 A_7, be A_8, Boolean A_9, DataTable A_10, Int32 A_11, String A_12)
 在 er.a(String A_0, EmailAddressCollection A_1)
 在 er.a(Boolean A_0, String A_1, EmailAddressCollection A_2)
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Alex AfterLogic Support
 
  
  
 Joined: 19 November 2003
 Online Status: Offline
 Posts: 2207
 | 
          This exception is thrown because you have many threads attempting to write into the same log file simultaneously.
           | Posted: 13 May 2008 at 4:27am | IP Logged |   |  
           | 
 |  
 To synchronize access to the log file, use SyncRoot property of Logger class:
 
 
| Code: 
 
    
    | 
      
       | object sync = new object();
 
 Smtp mailer1 = new Smtp();
 mailer1.Log.SyncRoot = sync;
 Smtp mailer2 = new Smtp();
 mailer2.Log.SyncRoot = sync;
 ... etc ...
 
 |  |  |  Regards,
 Alex
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | shaokao Newbie
 
  
  
 Joined: 08 May 2008
 Location: China
 Online Status: Offline
 Posts: 9
 | 
          thanks
           | Posted: 13 May 2008 at 11:30pm | IP Logged |   |  
           | 
 |  | 
       
        | Back to Top |     | 
       
       
        |  |