IOException in EF6 connection close
Posted by: Peter Gomis
Date: June 27, 2018 01:47PM

I have a C# application that is reading and writing data to a MySQL instance hosted in Azure (5.7.21). It is running on a machine with .NET Framework 4.7 on it.

The application is using Entity Framework 6.1.3 and MySQL Connector 6.10.7.

When the application terminates, the following exception is getting thrown when the Entity Framework DBContext goes out of scope and attempts to close the connection:

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.Socket.Send(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
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.Security.SslStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at MySql.Data.MySqlClient.TimedStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at MySql.Data.MySqlClient.MySqlStream.SendPacket(MySqlPacket packet)
at MySql.Data.MySqlClient.NativeDriver.ExecutePacket(MySqlPacket packetToExecute)
at MySql.Data.MySqlClient.NativeDriver.Close(Boolean isOpen)

Has anyone else seen this before? Suggestions on how to resolve?

Options: ReplyQuote


Subject
Written By
Posted
IOException in EF6 connection close
June 27, 2018 01:47PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.