Click here to Skip to main content
15,897,226 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Don`t understand error after deploy in IIS. it gives error sometime directly.


C#
Server Error in '/FFW' Application.

ExecuteReader requires an open and available Connection. The connection's current state is connecting.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.InvalidOperationException: ExecuteReader requires an open and available Connection. The connection's current state is connecting.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 


[InvalidOperationException: ExecuteReader requires an open and available Connection. The connection's current state is connecting.]
   System.Data.SqlClient.SqlConnection.GetOpenConnection(String method) +4874932
   System.Data.SqlClient.SqlConnection.ValidateConnectionForExecute(String method, SqlCommand command) +11
   System.Data.SqlClient.SqlCommand.ValidateCommand(String method, Boolean async) +144
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +87
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +32
   System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +141
   System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +12
   System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) +10
   System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +130
   System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +287
   System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) +94
   user_master.Page_Load(Object sender, EventArgs e) +227
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +50
   System.Web.UI.Control.LoadRecursive() +141
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627

Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053

please help me...
Mitesh
Posted
Updated 25-May-12 2:53am
v3
Comments
Zoltán Zörgő 25-May-12 8:54am    
Are you sure you need ASP.NET 2.0, not 4.0?
ZurdoDev 25-May-12 11:05am    
The error is saying that you are trying to execute a SQL statement against a connection that is not quite ready yet. Can you post the code that is causing this issue?
[no name] 26-May-12 0:15am    
this error come unexpected time means come at randomly on random page.my website is used by more than one person. so there is some change in setting of IIS. if yes,please tell me. my website is on My domain.
[no name] 26-May-12 0:18am    
i will use connection where on every page load

if (!IsPostBack)
{
c.setcon();
}

and use Appcode :
public void setcon()
{
try
{

con = new SqlConnection();
con.ConnectionString = @"Data Source=DATA-SERVER;Initial Catalog=fmweb;User ID=sa";
if (con.State == ConnectionState.Closed)
{
con.Open();
}
}
catch (Exception e1)
{
e1.Message.ToString();
}


}
[no name] 26-May-12 1:22am    
error of ExecuteNonQuery requires an open and available Connection. The connection's current state is closed. when logout button click.


Class1.document_reader = "No Document Read";
Class1.sign_out=System.Convert.ToString(DateTime.Now);
string s = "insert into User_log values('" +lbl_uname.Text+ "','" + string.Format("{0:dd/MM/YYYY}",Class1.sign_in)+ "','" + string.Format("{0:dd/MM/YYYY}",Class1.sign_out) + "','" + (Class1.document_reader) + "')";
SqlCommand cmd = new SqlCommand(s, c.getcon());
cmd.ExecuteNonQuery();
Session.Abandon();
Response.Redirect("default.aspx");

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


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