我正在嘗試運行我的 ASP.NET Core MVC 應用程式,但是當我這樣做時,我收到了這個錯誤:
options.UseSqlServer(builder.Configuration.GetConnectionString("Farah_O_Exercise_4Context") ?? throw new InvalidOperationException("未找到連接字串'Farah_O_Exercise_4Context'。")));
這是在應用程式上單擊頁面后的結果
uj5u.com熱心網友回復:
您必須在 appsettings.json 中添加連接字串:
"ConnectionStrings": {
"Farah_O_Exercise_4Context": "Server=(localdb)\\mssqllocaldb;Database=yourDbName;Trusted_Connection=True;MultipleActiveResultSets=true"}
希望這對你有幫助!祝你今天過得愉快 :)
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/468877.html
標籤:C# 剃刀 asp.net-core-mvc
下一篇:寫入JSON檔案并從中讀取
