0

I have a problem connecting a database using ASP.NET MVC and the identification system. I want to connect to mySQL.

First, I launched xampp, next definition connection string. And then in the Configure Services method, I used UseMySQL instead of the default connection.

If I enter the default connection in various forms, I have throw error that the string cannot be converted to Microsoft.EntityFrameworkCore.Serverversion.

I found a similar problem and wrote MySqlServerVersion, but it doesn't work. GetConnectionString doesn't take 2 arguments.

https://i.sstatic.net/gIH2s.png

https://i.sstatic.net/zFlPI.png

Could someone please tell me what I am doing wrong? And sorry for my English.

2
  • 1
    Please add code as text not images! Commented Mar 10, 2022 at 9:19
  • Could you pls share which package do you use for UseMySql extension? Besides which is your real target framework, asp.net core or asp.net? Commented Mar 11, 2022 at 1:48

1 Answer 1

1

UseMySql takes 2 arguments, the ConnectionString and the Version (optional). You're trying to set the version when you get the connection string, simply move your parentheses up a level:

options.UseMySql(Configuration.GetConnectionString("DefaultConnection"), new MySqlServerVersion(new Version(8, 0, 11))

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.