开发者

sqlconnection pooling problem

Hi i got a web application(asp.net) where we just started getting "System.InvalidOperationException: Timeout expired." when trying to get a new sql connection.

So my guess some where in the code a connection is created but never disposed, but how would i go about to find where this happens? sadly most of the database communication does not use a datalayer it works directly with the sql data types...

Is there any thing i could enable in the web.config to trace what connections are open for longer then x seconds and wher开发者_JAVA百科e they where opened?


find everywhere your sqlconnection is used. Ensure it is in a using() block to automatically dispose of it. There is nothing built in to the web.config with this unfortunately. You may be able to try out ants memory profiler to help track this down. for ex: http://www.developerfusion.com/review/59466/ants-memory-profiler-51/


Ok i found a way to track them down by using

EXEC SP_WHO2
DBCC INPUTBUFFER(SPID)

SP_WHO2 gives you information about the connections and by using DBCC INPUTBUFFER you can find out what command they ran last time.


.NET framework will not solve your architecture and logging issues so you will have to find the problem yourselves. What can help you:

  • Performance counters can show you utilization of connection pool
  • SQL Server Management Studio can show you connections in use, their activity and last executed statement. In Object Explorer select the server and in context menu go to Reports > Standard Reports > Activity xxx

Another approach is turning off the pool and using some profiler to collect information about your application and track not disposed connections.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜