0

Old Project
Web.config

Following ConnectionString use for App_Data Database Connection

  <add name="MaContext" connectionString="Data Source=.\SQLEXPRESS;

 AttachDbFilename=|DataDirectory|MaintenanceDB.mdf;Integrated 
 Security=True;User Instance=True" providerName="System.Data.SqlClient" />  

Now I am using Asp.net Core With .NET 5

appsettings.json

 "ConnectionStrings": {

  "BCAContext": "Data Source=.\\SQLEXPRESS;   AttachDbFilename=|DataDirectory|\\MaintenanceDB.mdf;

  Integrated Security=True;User Instance=True;"
  }

Error

enter image description here

User
  • 1,334
  • 5
  • 29
  • 61
  • 1
    It search for the mdf file in the bin/debug/net5.0 folder. Place it there – mehmetx Jan 07 '21 at 05:48
  • but My database inside App_data so any thing need to change to access project app_data same i used in asp.net framework old version – User Jan 07 '21 at 05:52
  • 1
    check here https://stackoverflow.com/questions/37058684/how-to-set-the-right-attachdbfilename-relative-path-in-asp-net-core – mehmetx Jan 07 '21 at 05:57
  • now error is No service for type 'BCA_New_System.Models.BCAContext' has been registered.' – User Jan 07 '21 at 06:04

0 Answers0