Unfortunately, nothing worked for me, I spent days trying to figure it out, and I ended up doing the following: -
1- I created a ping endpoint
2- I used Azure logic app to send requests to the ping endpoint every 5 minutes
app.MapGet(“/ping”, async (IDBSettings database) =>
{
await database.Connection.ListDatabaseNamesAsync();
return “refreshed”;
});
this way the connection to the database will be refreshed and the timeout problem won’t appear