D
D
Dmitry Bashinsky2018-05-02 22:26:03
ASP.NET
Dmitry Bashinsky, 2018-05-02 22:26:03

ASP NET CORE EF How to connect MySQL?

Hello. I don’t know what to do anymore, I don’t change how the server still doesn’t find this connection string.
My application config:

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

yRVdMY2.png
The data was taken from Beget hosting, access from all addresses seems to have been opened.
Next, I register in DI:
var connectionString = configuration.GetConnectionString("MainDB");
            services.AddDbContext<MainContext>(op => op.UseSqlServer(connectionString));

When accessing the table, I expect to receive an Exception stating that there is no table (because I have not done the first migration yet). And I get an error that the server cannot find.
Win32Exception: Не найден сетевой путь
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

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question