Setting the connection string with username and password in ASP.Core MVC

I am working on my first ASP.Core MVC application. What is the correct way to specify a connection string in an ASP.NET Core MVC application with a sql backend server that requires sql authentication?

ArgumentException: keyword not supported: 'userid'. \

The following is the appsettings.json file. When I launch the application, it gives an error message

{
  "ApplicationInsights": {
    "InstrumentationKey": ""
  },
  "ConnectionStrings": {
      "DefaultConnection": "Server=myserver;Database=mydatabase;userid=id;password=mypwd"
  },
    "Logging": {
      "IncludeScopes": false,
      "LogLevel": {
        "Default": "Debug",
        "System": "Information",
        "Microsoft": "Information"
      }
    }
  }
+4
source share
3 answers
user<space>id

Server = myServerAddress; Database = myDataBase; User id = myUsername; Password = MyPassword;

https://www.connectionstrings.com/sql-server/

+12
source

User ID userid?

, user id,

0

By installing Integrated security = falsein the connection string in the file web.config, this error will be resolved.

0
source

Source: https://habr.com/ru/post/1666670/


All Articles