Keyword not supported: 'server'

Viewed 52045

I've been trying to edit my connection string for uploading my website to a server.
I am not really experienced with this. I got this exception: the Keyword not supported: 'server'.
Here is my connection string:

<add name="AlBayanEntities" connectionString="Server=xx.xx.xxx.xxx,xxxx;Database=AlBayan;Uid=bayan;Password=xxxxx;" providerName="System.Data.EntityClient" />

I've tried embed this string into my old connection string which works very well locally, but it didn't fit : S

8 Answers

Same happened to me when using Rider IDE for a .net core 2.2 project. As Rider automatically sets up Sqlite in Startup.cs in the "ConfigureServices" method.

By changing

services.AddDbContext<ApplicationDbContext>(options =>
    options.**UseSqlite**(
        Configuration.GetConnectionString("DefaultConnection")));

into

services.AddDbContext<ApplicationDbContext>(options =>
    options.**UseSqlServer**(
        Configuration.GetConnectionString("DefaultConnection")));

issue was resolved. Of course, first you have to install nuget packages for EF SQLServer and add the connection string to appsettings.json.

In my case, I found that my project had the EFSQLLite nuget package installed, which seems doesn't recognise the Server= keyword. I uninstalled that nuget and installed the full EFSQLSERVER one, and it worked fine

Related