开发者

Deadlocks in client-server application

I'm a .NET propgrammer. Recently, I wrote a client-server application that uses System.Net.Sockets for connecting and uses .NET remoting for communica开发者_开发百科tions. When the number of clients increased (up to 100), sometimes the server application freezed and after several minutes came back to normal. I use SQL 2005 with pooling and timeout.


Check whether you are disposing everything that is IDisposable in your data access code - connections, for example. So for example, if you are using a SqlConnection class, you would write code like so:

using (var connection = new SqlConnection(...))
{
    // code to do something with the connection
}

This would ensure that the .NET connection is closed, releasing the physical SQL Server connection to the pool. If you're not doing this, then the pool will run out of available connections until some of them start timing out and are closed automatically.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜