Why would moving our .NET /SQL Server website to a new host cause connection pool size to be exceeded?

别说谁变了你拦得住时间么 提交于 2019-12-05 19:11:48

Most likely your code is leaking connections all over the place.

I'd bet money your old host had the app pool set to recycle pretty often, either from a memory usage or # requests processed point. The new host most likely has default cycling in place.

My recommendation is to first set the app pool to recycle a lot more often. Then fix the code. Either by refactoring out the DSLibrary (guessing that's home grown) or by simply changing it over to using clauses whereever you have database connections made.

update
One more thing, change your session properties to use sql server as the backing store that way you won't lose all the session information as the app recycles. This will buy you more time.

Have you checked the maximum number of concurrent connections property (Server Properties -> Connections tab)?

From what you say you don't appear to be wrapping the database in a using statement so you're leaking a connection each time. The system dumps the stuff when it gets around to it unless you explicitly dispose it--which is the purpose of using. You must always use a using (or otherwise ensure dispose is called) on anything that represents a resource outside your program. Files, database connections etc.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!