Working on Migrating .NET Framework to .NET core 6. I am trying to run the application which is not able to read the connection string from appsettings.json file. I have shown the appsettings.json file as well. Please let me know what I need to do. Old application reads from web.config file.
Context File
public partial class PayMyRentEntities : DbContext
{
public PayMyRentEntities()
: base("name=PayMyRentEntities")
{
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
throw new UnintentionalCodeFirstException();
}
public virtual DbSet<Category> Categories { get; set; }
public virtual DbSet<Hospital> Hospitals { get; set; }
public virtual DbSet<LookupType> LookupTypes { get; set; }
public virtual DbSet<LookupValue> LookupValues { get; set; }
}
Appsetting.json
{
"WebApiPublishUrl": "http://localhost:61330/",
"ConnectionStrings": {
"PayMyRentEntities": "metadata=res://*/PMR.csdl|res://*/PMR.ssdl|res://*/PMR.msl;provider=System.Data.SqlClient;provider connection string=\u0022data source=ACDSK3;initial catalog=Phnix;user id=hyd3;password=hyd3;integrated security=false;MultipleActiveResultSets=True;App=EntityFramework\u0022"
}
}
Runtime Error :