S
Stefan Hellberg
Hello everyone,
I have a big problem with my ASP .NET project that I hope
anyone knows something about.
Windows 2000
SQL Server 2000
NET Framework 1.1
I get the below exception.
------
System.InvalidOperationException:
Timeout expired. The timeout period elapsed prior to
obtaining a connection from the pool. This may have
occurred because all pooled connections were in use and
max pool size was reached.
------
Im using Microsoft Data Application block to create
DataReaders in my business class methods. Im not
providing a connection object to the Data Application
Block method, instead I provide the connection string so
a connection will be created each time a DataReader is
created and closed when I call the DataReaders close
method.
Some pages makes alot of calls to different business
object methods, so lets say a normal number of calls
could be 10-20 for each page load. On some pages I also
have recursive methods, for example, a menu creation
method that calls itself to get child links.
If a few recursive methods is used on a page, then alot
more connections to the database is made by a single
user, probably a total of 30-80.
--
Is it bad design that each method creates a new
connection and closes it?
(I thought that with connection pooling it doesnt really
mattered even if this was done many times by a single
user)
Should I instead redesign so that I create a connection
object before any business classes is used and pass that
connection with each call to the Data Application Block
and explicity close that connection at the end of my ASP
page when no more business objects are used?
Anyone that have any help for me on this?
If my approach is wrong, then where is the best place to
create and close a connection?
Lighten up my world please
All help will be very appreciated.
Regards
Stefan Hellberg
I have a big problem with my ASP .NET project that I hope
anyone knows something about.
Windows 2000
SQL Server 2000
NET Framework 1.1
I get the below exception.
------
System.InvalidOperationException:
Timeout expired. The timeout period elapsed prior to
obtaining a connection from the pool. This may have
occurred because all pooled connections were in use and
max pool size was reached.
------
Im using Microsoft Data Application block to create
DataReaders in my business class methods. Im not
providing a connection object to the Data Application
Block method, instead I provide the connection string so
a connection will be created each time a DataReader is
created and closed when I call the DataReaders close
method.
Some pages makes alot of calls to different business
object methods, so lets say a normal number of calls
could be 10-20 for each page load. On some pages I also
have recursive methods, for example, a menu creation
method that calls itself to get child links.
If a few recursive methods is used on a page, then alot
more connections to the database is made by a single
user, probably a total of 30-80.
--
Is it bad design that each method creates a new
connection and closes it?
(I thought that with connection pooling it doesnt really
mattered even if this was done many times by a single
user)
Should I instead redesign so that I create a connection
object before any business classes is used and pass that
connection with each call to the Data Application Block
and explicity close that connection at the end of my ASP
page when no more business objects are used?
Anyone that have any help for me on this?
If my approach is wrong, then where is the best place to
create and close a connection?
Lighten up my world please
All help will be very appreciated.
Regards
Stefan Hellberg