I have a .net web api that use postgresql. Backend is deployed on azure. Sometimes this error occures. I have max_connection set to 50, and I think it should be enough. In my code i use Entity Framework Core.
How to handle this problem because I can’t find why and where it throws.
2
Answers
Try to limit number of pooled connections in EF Core. For Npgsql it will be parameter
Maximum Pool Size=45
in connection string (default value is 100).More info: https://www.npgsql.org/doc/connection-string-parameters.html
I think you need to check the connections usage for the database and making sure you are closing and disposing of connections properly after use. For you to have detailed process on how to handle that issue you can follow this article here, and also this stackoverflow question which is similar to yours, here