I am using the default value of MAXBUfferPoolSIzeand MaxBufferSize. However, I am recieving an error:
"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.".
The Max Pool size is also increased. How can I find the value that should be appropriate for MAXBUfferPoolSIze and MaxBufferSizeto avoid this error.
If you are seeing this it is telling you about a problem – the answer is not usually “make the pool bigger” – it is “stop leaking connections”.
This almost universally means that you are not disposing a connection in one or more places. It is the call to
Dispose()that makes a connection available in the pool, so whenever you are using a connection it is critical that you dispose it – otherwise you are dependent on garbage collection, which is non-deterministic. For example – make sure you have: