Click here to Skip to main content
15,920,685 members
Please Sign up or sign in to vote.
3.50/5 (2 votes)
See more:
I am getting following server error in asp.net application, even i mentioned Max Pool Size="100" in web.config file
Error : "Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may occurred because all pooled connections were in use and max pool size was reached."
Posted
Updated 5-Sep-12 23:34pm
v2
Comments
manognya kota 6-Sep-12 5:21am    
Are you closing the database connections that are opened?

Friend,

This will help U!!

when we deal with huge amount of data, generally it may occur TIMEOUT problem...
in those situations Take care of 3 things ( problem will be almost solved )
1. put the connection timeout property in Connection string
string connstring=" Data Source=localhost;User ID=sa; pwd=secret; Initial catalog=nothwind;connect timeout=900;";
2. set the command timeout for the SqlCommand Object
com.CommandTimeout=0; // this will makes Command to execute unlimited seconds
3. Now .... last but not the least... in the form unload function
destroy the connection object
conn.Dispose();
that's it

regards
Karthik.J
 
Share this answer
 
Comments
rockey chauhan 2-Aug-13 2:28am    
Kartik you are saying after set com.CommandTimeout=0; this will makes Command to execute unlimited seconds then why you are setting timeout in connection string.
S.V.Aaditya.S.V 10-Jun-15 3:07am    
rockey...
Even I too tried applying timeout=0 in connectionstring, but the page in which I am using cmd execution is showing error.
So, when I did keep timeout=0 for cmd like cmd.connectiontimeout=0; it really worked.

As much I understand, when using for cmd, it is setting for cmd alone and for connection string may be it's using only in page load.

I'm not sure about my assumption on connection string, but sure for cmd.connectiontimeout.
mshuaib 9-Jul-15 3:31am    
Thanks dude its working ....
Just Chnage Timeout value in your connection string..
For eg:" Data Source=localhost;User ID=sa; pwd=admin; Initial catalog=MyChioce;connect timeout=1200;";

Or
Set your web configfile this code.

XML
<authentication mode="Forms">
    <forms loginUrl="~/Account/Login.aspx" timeout="2880"/>
  </authentication>
 
Share this answer
 
Comments
vishal.shimpi 7-Sep-12 7:40am    
Hi,
i have done this but still i am facing the following error.....

Server Error in '/' Application.
--------------------------------------------------------------------------------

Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customerrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customerrors> tag should then have its "mode" attribute set to "Off".


<!-- Web.Config Configuration File -->

<configuration>
<system.web>
<customerrors mode="Off">




Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customerrors> configuration tag to point to a custom error page URL.


<!-- Web.Config Configuration File -->

<configuration>
<system.web>
<customerrors mode="RemoteOnly" defaultredirect="mycustompage.htm">

If you are using a grdiview and populating it with large amount of data from database, this type of error occurs , so try using paging on the gridview table. This will solve the problem

Set
SQL
allowpaging
property of grid view to true

and set
SQL
pagesize
property to no of records you want in each page.

in pageindex changing event write the following code
C#
gridview1.pageindex=e.newpageindex;
 
gridview1.databind();


Regards,
Abhisheik.yk
 
Share this answer
 
Hi,

I found the same problem when i was trying to dynamically change color properties to a GridView that already have format, so i delete the gridview and insert a new one but without preselect format(maybe only by changing the preselect format would also work), and voilá evrething went ok, even the dyanamic changes. Hope this can help if it's your same problem.

Regards.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900