I was trying to deploy one of our applications on a customer’s environment. We have a database server on their network, and a web server. I installed the database, installed the web application and tried to run it. It didn’t. Our logfile showed this:
System.InvalidOperationException: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.
I figured i had made a mistake with the configuration of SQL Server, so i checked some settings and tried it again. Still didn’t work. Did this a couple of times but i couldn’t get it to connect to the database and i kept getting the same error.
Eventually i wrote a stupid winforms app with a button that would connect to a database based on a connection string in its app.config file. Copied it to the webserver, copied the connection string from the web application to the config file of the stupid winforms app and tried it. Still got the same exception.
I figured there might be a problem with connecting to the database from the web server, so i copied the stupid winforms app to the database server and tried it there. It still didn’t work, even though i could connect without problems using SQL Server Management Studio.
After a while i finally noticed that i had mistyped the name of the database server in the connection string, and once i typed the correct name, everything worked ![]()
Total time lost: about 90 minutes.
Required change: adding 1 extra character to the connection string.
Then again, i would’ve noticed this sooner if the exception message was a bit more clear about the actual problem (not finding the server) ![]()