An existing connection was forcibly closed by the remote host

The website for Boomershoot entries uses an email API to automatically send email to entrants and for sending out mass emails to the announcement list. This had worked fine for Boomershoot 2023. But as I was ready to announce Boomershoot 2024 in early summer it failed with an error:

Azure.RequestFailedException: The underlying connection was closed: An unexpected error occurred on a send. —>
System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. —>
System.IO.IOException: Unable to read data from 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.Read(Byte[] buffer, Int32 offset, Int32 size)

I worked on the problem for quite a while (many hours off and on over several days). Then I tried using a different provider for the email service. The same exact error occurred.

Frustrated, I would set it aside for a month or so and worked on it again on some weekends. No luck.

People realized that the web site actually accepted entries even if it had not been announced. Then, a couple months ago, to my great surprise, I discovered that about 10% of the time the email did work. WHAT?!! Is it a timing issue? I did lots of experiments without success.

Yesterday, I started doing web searches with various search parameters to try and find the solution. Somewhat buried on one web page I found a suggestion, put this in your C# program anyplace before you attempt to make your connection with the other server:

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

Since the web page was several years old I first tried using Tls13, newer is better, right?

No luck.

So I tried the original suggestion, Tls12. This worked.

There was great joy in Boomershoot land!

I’m making the blog post about this so perhaps other people can find the answer more easily than I was able to.

The complete error (exception call stack) is below the fold.

Continue reading

Boomershoot 2024 is Open For Entries!

Boomershoot is just 10 weeks away!

As some of you know I had problems getting email to work reliably. Hence the opening of Boomershoot entry is much later than normal. The website is now working well and entries are being processed correctly.

There were numerous people who discovered the site was accepting entries even though I had not announced it. There are still 34 great shooting position open so even though you didn’t get signed up as early as usual, you still have a chance to join the party.

Don’t miss out. Sign up soon: http://entry.boomershoot.com/ With a ton of explosives it will be a real blast!

See Boomershoot.com for more information about this amazing event.