I am trying to get the connectionstring from appsettings.json to program.cs:
appsettings.json
"ConnectionStrings": {
"Default": "server=RWAHDAN; database=hspa; User Id=user; password=Pass;"
},
in program.cs:
var theConnection = builder.Configuration.GetSection("ConnectionStrings:Default").Value;
builder.Services.AddDbContext<DataContext>(options =>
options.UseSqlServer(theConnection));
getting error:
"ErrorMessage": "An exception has been raised that is likely due to a transient failure.
Consider enabling transient error resiliency by adding 'EnableRetryOnFailure' to the 'UseSqlServer' call.",