开发者

Deadlocks in client-server application

开发者 https://www.devze.com 2022-12-26 14:29 出处:网络
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

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

精彩评论

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

关注公众号