none
SmtpClient, Unable to read data from the transport connection: net_io_connectionclosed.

    Question

  • Can somebody give me a deep explain about this?

    Scenario 1, 3 will get exception, the error message will be like "Unable to read data from the transport connection: net_io_connectionclosed.",

    but Scenario 2 works fine.

    Scenario 1:

    MailMessage message = new MailMessage();
    message.IsBodyHtml = false;
    message.From = new MailAddress("abc@def.com");
    message.To.Add(new MailAddress("abc@def.com"));
    message.Subject = "subject test";
    message.Body = "body test";

    SmtpClient smtp = new SmtpClient("def.com");
    smtp.ServicePoint.MaxIdleTime = 90000;
    smtp.Timeout = 90000;

    smtp.Send(message);//send out the first email successfully

    System.Threading.Thread.Sleep(70000);

    smtp.Send(message);//the second email can't be send out

    Scenario 2:

    MailMessage message = new MailMessage();
    message.IsBodyHtml = false;
    message.From = new MailAddress("abc@def.com");
    message.To.Add(new MailAddress("abc@def.com"));
    message.Subject = "subject test";
    message.Body = "body test";

    SmtpClient smtp = new SmtpClient("def.com");
    smtp.ServicePoint.MaxIdleTime = 60000;
    smtp.Timeout = 60000;

    smtp.Send(message);//send out the first email successfully

    System.Threading.Thread.Sleep(70000);

    smtp.Send(message);//the second email can be send out successfully

    Scenario 3:

    MailMessage message = new MailMessage();
    message.IsBodyHtml = false;
    message.From = new MailAddress("abc@def.com");
    message.To.Add(new MailAddress("abc@def.com"));
    message.Subject = "subject test";
    message.Body = "body test";

    SmtpClient smtp = new SmtpClient("def.com");
    smtp.ServicePoint.MaxIdleTime = 60000;
    smtp.Timeout = 60000;

    smtp.Send(message);//send out the first email successfully

    int i = 0;//in debug mode, stop here for 70 seconds, and then run to the end

    smtp.Send(message);//the second email can't be send out

    • Moved by Mike Feng Friday, January 11, 2013 8:50 AM
    Friday, January 11, 2013 12:10 AM

All replies

  • Hi Eric, 

    I have moved this thread to a dedicated forum for more responses.

    Thank you.

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, January 11, 2013 8:52 AM
  • Hi Eric,

    I tested all the three scenarios for .Net framework 2.0, 3.5 and 4.0. In none of the test cases I was able to reproduce the issue. In all these cases, emails was sent without any issues. I even tested the issue with Visual Studio 2008 and 2010.  Therefore I really can’t comment on the results that you had observed in your environment.

    If you still observe the issue then I would recommend you to open a new support case as it will enable us to provide a more in-depth level of support. 

    Please visit the link below to see the various paid support options that are available to better meet your needs.

    http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone

     
    Regards,
    Shailesh G. Rajput
    ______________________________________________
    Microsoft Developer Support - Messaging & Collaboration

    Friday, March 15, 2013 11:47 PM