ASP NET CORE EF How to connect MySQL?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
27 views
Hi all. I don't know what to do, how not change how the connection string still does not find the server.

My application configuration:
"ConnectionStrings": { "MainDB": "Server=sbm15yyj.beget.tech;Database=sbm15yyj_dicedev;User Id=sbm15yyj_dicedev;Password={pass};" }


yRVdMY2.png
Data is taken from the hosting Beget, access from all addresses, like opened.

Next, register in the DI:
var connectionString = configuration.GetConnectionString("MainDB"); services.AddDbContext(op => op.UseSqlServer(connectionString));


When referring to the table expecting to get an Exception that table is not (because you haven't made the first migration). And get the error that cannot find the server.

Win32Exception: the network path Not found SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)


Lk1GPek.png
by | 27 views

1 Answer

0 like 0 dislike
Are you using package for working with MSSQL to connect to MySQL.
You here https://dev.mysql.com/doc/connector-net/en/
by

Related questions

0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
110,608 questions
257,187 answers
0 comments
40,796 users