IOException Unable to write data to the transport connection

A client of one of the non-Community Server sites I manage emailed me with a screenshot of a .NET error that occurred when they tried to use a site email service.  Salient excerpt runtime error bits below.

Google keywords: “An established connection was aborted by the software in your host machine” and “Unable to write data to the transport connection.”

There were permission changes made on the network recently that caused some of my SQL Server jobs to fail, so perhaps this was causing similar problems in Exchange World. One thing for sure, as a developer, don’t you hate it when something happens outside of your realm of control that causes your app to break?  Dang-gummit, eh?

It doesn’t happen often, but Google failed me on this. There were suggestions of investigating Virus filtering and changing enumeration casting which worked for someone (what?), but nothing helpful.

Here is a possible fix to add to the Google Pool. Specify the actual host name in the host property of the smtp network element in the web.config. I had “localhost” specified, which worked for a long time…until it didn’t.

<smtp>
    <network host=”mail.somewhere.com” userName=email@somewhere.com
            password=”password” />
</smtp>

—————-

The application really isn’t called “DAVE BURKE’S SWEET APP.” I just like to say that.

Server Error in ‘/DAVEBURKES_SWEET’ Application.

Exception Details: System.Net.Sockets.SocketException: An established connection was aborted by the software in your host machine Stack Trace:

[IOException: Unable to write data to the transport connection: An established connection was aborted by the software in your host machine.]

[SmtpException: Failure sending mail.]
System.Net.Mail.SmtpClient.Send(MailMessage message)
+2074 DBVTSWEETAPP.docemail.EmailDoc() +1039

Article written by

A long time developer, I was an early adopter of Linux in the mid-90's for a few years until I entered corporate environments and worked with Microsoft technologies like ASP, then .NET. In 2008 I released Sueetie, an Online Community Platform built in .NET. In late 2012 I returned to my Linux roots and locked in on Java development. Much of my work is available on GitHub.