0

I'm using an Asp.NET Web Application with MSSQL Server. In my page i open a connection and i close it at the end of page. But in Sql Analyzer the Sql session is still there, giving me after some amount of time a connection pool limits exceed error. Sessions are cleared only when i shutdown the webserver.

Can someone explain how to fix this? Thanks

This is the code i'm using:

Conn = new SqlConnection(StrConn);
Conn.Open();

.....

Conn.Close(); // In the debugger i can see connection state = closed
Conn = null;
5
  • Can you post the code that's opening and closing the connection. Commented Jul 2, 2012 at 10:58
  • 1
    Most likely connection pooling issue - try adding Pooling=false to the connection string. What happens? Commented Jul 2, 2012 at 11:51
  • Might need some more detail than that... Where is the connection opened, where is it closed? How is the open called? Commented Jul 2, 2012 at 11:51
  • @ShadowThePrincessWizard you are legend. Thanks a lot man, I just added that magic parameter in the connection string and now it works as it should. Commented Dec 2, 2019 at 9:38
  • 1
    @ShadyOverflow huh, lol.... so much time passed. Will post this as answer. Thanks for the reminder! (I know you're not the OP. ;)) Commented Dec 2, 2019 at 9:46

1 Answer 1

2

This appears to be a connection pooling issue.

Add Pooling=false to the connection string, and the database won't keep the connection open.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.