My app when executed locally does not read ConnectionString from the appsettings.json. I had configured "Connected Services" in VS2019 for my ASP.NET Core 3.1 app. Where the SQL DB connection got a wrong DB name (probably got autogenerated). I then have deleted this configuration and ignored it from my profile. But now when I'm trying to execute this app locally - it is still trying to use DB from that config.
Microsoft.Data.SqlClient.SqlException (0x80131904): Cannot open database "aspnet-53bc9b9d-9d6a-45d4-1122-2a2761773502" requested by the login. The login failed.
1. Is there a place it is got cached at or where I need to remove it manually from?
2. Also why it does not read from my appsettings.json?
appsettings.json:
**{
"Serilog": {
"Using": [
"Serilog.Sinks.Console",
"Serilog.Sinks.File",
"Serilog.Sinks.Seq",
"Serilog.Sinks.Loggly"
],
"MinimumLevel": {
"Default": "Debug",
"Override": {
"Microsoft": "Debug",
"System": "Debug"
}
},
"Enrich": [
"FromLogContext",
"WithMachineName",
"WithProcessId",
"WithThreadId"
],
"WriteTo": [
{
"Name": "Console"
},
{
"Name": "File",
"Args": {
"path": "C:\\ODATA\\Logs\\log.json"
},
"formatter": "Serilog.Formatting.Json.JsonFormatter, Serilog"
}
],
"Properties": {
"Application": "ODataTestApp"
}
},
"ConnectionStrings": {
"Database": "Data Source=*MyDBConnectionString*"
},
"AllowedHosts": "*",
"ApplicationInsights": {
"ConnectionString": "InstrumentationKey=*my-key*/"
}
}**
P.S. I added those Connected Services as part of the Publish to Azure steps. I have tried to Publish my app to Azure, but it failed (for different reasons).