私は私の最初のASP.Core MVCアプリケーションに取り組んでいます。ASP.NET Core MVCアプリケーションで、SQL認証を必要とするSQLサーバーバックエンドで接続文字列を指定する正しい方法は何でしょうか。
ArgumentException:キーワードがサポートされていません: 'userid'.⇦。
以下は、私のappsettings.jsonファイルです。アプリケーションを実行すると、エラーが発生します。
{
"ApplicationInsights": {
"InstrumentationKey": ""
},
"ConnectionStrings": {
"DefaultConnection": "Server=myserver;Database=mydatabase;userid=id;password=mypwd"
},
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
}
}
}
user<space>id
Server=myServerAddress;Database=myDataBase;User Id=myUsername; パスワード=myPassword;
これは、次の例に示すように、正しいキーワードが「ユーザーID」であるためです。
"ConnectionStrings": {
"DefaultConnection": "Server=myServerAddress;Database=myDataBase;User Id=myUsername;password=myPassword;Trusted_Connection=False;MultipleActiveResultSets=true;"
}
web.configファイルの接続文字列にIntegrated security = false
を設定することで、このエラーは解決します。