0

I'm getting the exception

ArgumentException: Keyword not supported: 'persistsecurity info'

when attempting to read to the database after upgrading from .NET Core 1.1 to .NET Core 2.0. Project is using .NET Core MVC Framework with EF Core.

Appsettings.json

"ConnectionStrings": {
    "DBConnection": "Server=tcp: server.address, 1433;Initial Catalog=SmartDB;PersistSecurity Info=False;User ID=username;Password=password;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"
  }

Startup.cs

  services.AddDbContext<ApplicationDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("SmartDBConnection")));
Isaac
  • 310
  • 5
  • 16

2 Answers2

1

I think the argument is supposed to be Persist Security Info or PersistSecurityInfo, not PersistSecurity Info with just one space.

Matti Virkkunen
  • 63,558
  • 9
  • 127
  • 159
  • Thanks, this worked! But out of curiosity was this changed with .NET Core 2.0? Because it previously worked on .NET Core 1.1 – Isaac Apr 28 '18 at 06:24
1

It should be Persist Security Info so updated connection string would be,

 "DBConnection": "Server=tcp: server.address, 1433;Initial Catalog=SmartDB;Persist Security Info=False;User ID=username;Password=password;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"

`

programtreasures
  • 4,250
  • 1
  • 10
  • 29