I have a webservice that is called by up to 10 clients. The webservice is built up of 7 differnet asmx-pages and have about 100-200 functions in each page.
All those functions are working against a MSSQL2005 or MS SQL2000 database. Some periods of the day its heavy traffic from the clients and it seems like I run out of connections on the sql-server causing all clients to stop.
In every function I open a connection, do the stuff and then close the connection, sometimes with transactions sometimes without.
On the server I see that it creates a lots of connections, I dont know why they dont goes away, but stays there even after the function is done and over. So I can se that my 10 clients creates over 80 connections from time to time. Sometimes some of them goes away, sometime they are still there hours after used. Is there some kind of pooling going on there?
Question 1: Are there another way to handle connections I should use, like one connection globally per webservice or any other way?
Question 2: If its ok to handle connections per function then why does it not close the connection on the server, making the list of open connections larger and larger all the time until I got out of connections-error?
This question is related to my other question but not the same: http://stackoverflow.com/questions/407320/strange-sql2005-problem-sqlconnection-does-not-support-parallel-transactions
I have now narrowing it down to the "out of connections" error.