Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 28th, 2006, 12:56 AM
Registered User
 
Join Date: Sep 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default SocketException (0x2746): An existing connection w

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.
[u]My UI Code</u>

AdminListusers_BizLayer objAdmLstUsr = (AdminListusers_BizLayer)Activator.GetObject(typeo f(AdminListusers_BizLayer), "tcp://"+ConfigurationSettings.AppSettings["ConnectionPort"]+"/AMSPortalAdminListusers_BizLayer");


objAdmLstUsr.GetNumrecords(pstrLogin,ref intNumRecords);

[u]My Biz layer code</u>

AdminListusers_DalLayer objDal=new AdminListusers_DalLayer();



public void GetNumrecords(string pstrLogin,ref int intNumRecords)
        {
            objDal.GetNumrecords(pstrLogin,ref intNumRecords);
        }



[u]My GataLayer Code</u>

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.HandleRe turnMessage(IMessage reqMsg, IMessage retMsg) +264
   System.Runtime.Remoting.Proxies.RealProxy.PrivateI nvoke(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




 
Old September 28th, 2006, 07:16 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Dont double post;

http://p2p.wrox.com/topic.asp?TOPIC_ID=50340

--Stole this from a moderator

I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Existing Components Thami SQL Server 2005 0 August 8th, 2008 02:51 AM
An existing connection was forcibly closed by the vsmarimuthu ASP.NET 1.0 and 1.1 Professional 6 October 4th, 2006 10:22 AM
An existing connection was forcibly closed by the vsmarimuthu ASP.NET 2.0 Basics 0 September 28th, 2006 06:13 AM
Adding existing and non-existing attributes spencer.clark XSLT 5 July 27th, 2005 04:02 PM
Systems.Net.Sockets.SocketException mufo Pro VB.NET 2002/2003 0 October 28th, 2003 02:12 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.