Hi
I have a working code in VS 15 asp.net MVC 5 of MySQL connection. when I am going to connect with the same code in Vs 19 Asp.net MVC Core 3.1 it gives an error
Here is my code
NuGet package (MySql.Data (8.0.26))
using System.Data;
using MySql.Data.MySqlClient;
DataSet DsLoc = new DataSet();
MySqlDataAdapter da;
public IActionResult Index()
{
DataTable Dt = new DataTable();
DsLoc.Clear();
MySqlConnection con = new MySqlConnection("server=localhost;uid=root;pwd=1234;database=hrdb;");
con.Open();
da = new MySqlDataAdapter("select * from companymaster order by ID desc", con);
da.Fill(DsLoc, "Master-INFO");
Dt = DsLoc.Tables[0];
con.Close();
return View(Dt);
}
AND THIS IS THE ERROR
Inner Exception 1:
AggregateException: One or more errors occurred. (Unable to read data from the transport connection: An established connection was aborted by the software in your host machine..)
Inner Exception 2:
IOException: Unable to read data from the transport connection: An established connection was aborted by the software in your host machine..
Inner Exception 3:
SocketException: An established connection was aborted by the software in your host machine.
What I have tried:
I stop antivirus and firewall
I have added "SslMode=none" in my connection string
But Nothing work with VS 19 ASP.net MVC Core 31
Please Help Me to Fix This