|
Subject:
|
An existing connection was forcibly closed by the
|
|
Posted By:
|
vsmarimuthu
|
Post Date:
|
9/28/2006 6:13:14 AM
|
Hi all, For the past 2 days i am getting an exception like this. I this i am using remoting concept. plz check my code and tell me what is wrong with it. Its urgent From my UI i am calling an method in Buisness layer Which in turn call datalayer method. That datalayer method cpnnects to database. My UI Code
AdminListusers_BizLayer objAdmLstUsr = (AdminListusers_BizLayer)Activator.GetObject(typeof(AdminListusers_BizLayer), "tcp://"+ConfigurationSettings.AppSettings["ConnectionPort"]+"/AMSPortalAdminListusers_BizLayer");
objAdmLstUsr.GetNumrecords(pstrLogin,ref intNumRecords);
My Biz layer code
AdminListusers_DalLayer objDal=new AdminListusers_DalLayer();
public void GetNumrecords(string pstrLogin,ref int intNumRecords) { objDal.GetNumrecords(pstrLogin,ref intNumRecords); }
My GataLayer Code
public void GetNumrecords(string pstrLogin,ref int intNumRecords) { SqlConnection objSql=new SqlConnection(); try { objSql=GetConnection(); objSql.Open(); SqlCommand objCommand = new SqlCommand("pr_sel_records", objSql); //SqlCommand objCommand = new SqlCommand("pr_sel_records", mobjConn); objCommand.CommandType = CommandType.StoredProcedure; objCommand.Parameters.Add(new SqlParameter("@p_login", SqlDbType.VarChar, 20)); objCommand.Parameters["@p_login"].Value = pstrLogin; SqlDataReader objReader1 = objCommand.ExecuteReader(); if (objReader1.Read()) { intNumRecords = Convert.ToInt32(objReader1["num_records"]); } objReader1.Close(); } catch(SqlException Ex) { throw Ex; } finally { objSql.Close(); objSql.Dispose(); } } public DataSet GetTotalNumber(string strSQL) { DataSet objDSRecs=new DataSet(); SqlConnection objSql=new SqlConnection(); try { objSql=GetConnection(); objSql.Open(); SqlDataAdapter objDataAdapter = new SqlDataAdapter(strSQL, objSql); objDataAdapter.Fill(objDSRecs, 0, 0, "NumRecords"); } catch(SqlException Ex) { throw Ex; } finally { objSql.Close(); objSql.Dispose(); } return objDSRecs;
} public void SelectAllUsersIf(string strSQL,ref DataSet objDS) { SqlConnection objSql=new SqlConnection(); try { objSql=GetConnection(); objSql.Open(); SqlDataAdapter objDataAdapter = new SqlDataAdapter(); objDataAdapter.SelectCommand = new SqlCommand(strSQL, objSql); objDataAdapter.Fill(objDS, "Users"); } catch(SqlException Ex) { throw Ex; } finally { objSql.Close(); objSql.Dispose(); }
I am getting an error like this
An existing connection was forcibly closed by the remote host 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.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
Source Error:
Line 95: public void GetNumrecords(string pstrLogin,ref int intNumRecords) Line 96: { Line 97: objDal.GetNumrecords(pstrLogin,ref intNumRecords); Line 98: } Line 99: public DataSet GetTotalNumber(string strSQL)
Source File: e:\unisys\ramsbizlayer\adminlistusers_bizlayer.cs Line: 97
Stack Trace:
[SocketException (0x2746): An existing connection was forcibly closed by the remote host] System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) +264 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) +877 RAMSBizLayer.AdminListusers_BizLayer.GetNumrecords(String pstrLogin, Int32& intNumRecords) in e:\unisys\ramsbizlayer\adminlistusers_bizlayer.cs:97 UnisysRAMS.adminlistusers.GetNumRecords(String pstrLogin) in c:\inetpub\wwwroot\unisystest\adminlistusers.aspx.cs:2106 UnisysRAMS.adminlistusers.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\unisystest\adminlistusers.aspx.cs:2273 System.Web.UI.Control.OnLoad(EventArgs e) System.Web.UI.Control.LoadRecursive() System.Web.UI.Page.ProcessRequestMain()
-------------------------------------------------------------------------------- Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573
Please anybody who knows about this please help me
|
|