I'm trying to use Hangfire with SQL Server, reading the connection string from the appsettings.json file. It doesn't work. Only when I provide the connection string to the UseSqlServerStorage method, does it work.
Here's appsettings.json:
{
"ConnectionStrings": {
"HangfireDemo": "Data Source=VSQL64;Initial Catalog=HangfireDemo;Integrated Security=SSPI;"
},
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
}
}
}
And here the line that configures Hangfire in Startup.ConfigureServices:
services.AddHangfire(configuration => configuration.UseSqlServerStorage("Data Source=VSQL64;Initial Catalog=HangfireDemo;Integrated Security=SSPI;"));
If I write "HangfireDemo" in the UseSqlServerStorage method, it doesn't work. Only the full connection string in this method works.
How can I provide just the connection string name?