ASP.Net Core Entity Framework Error: value cannot be null. (Parameter 'connectionString')

Mehram
 
on Dec 29, 2020 10:28 PM
5224 Views

Dear Experts,

I need your support to create my first web application in asp.net Core. Unable to connect database sql server 2014.

appsetting.json

"ConnectionString": {
    "DefaultConnection": "Server=MEHRAM\\MSSQL2014;Database=ifapkcom;Trusted_Connection=True;MultipleActiveResultSets=True"
},

Startup.cs  

public void ConfigureServices(IServiceCollection services)
{
    services.AddDbContext<clsApplicationDbContext>(option => option.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
    services.AddRazorPages().AddRazorRuntimeCompilation();
}

Package manage console. 

PM> 

Package Manager Console Host Version 5.4.0.6292

Type 'get-help NuGet' to see all available NuGet commands.

PM> 

add-migration AddMemberListToDB is showing following error:

value cannot be null. (Parameter 'connectionString')

Download FREE API for Word, Excel and PDF in ASP.Net: Download
dharmendr
 
on Dec 30, 2020 02:51 AM

Hi Mehram,

Refer below article and follow the steps.

ASP.Net Core: Simple Entity Framework Tutorial with example