remoting error

Discussion in 'ASP .Net' started by =?Utf-8?B?QVZM?=, Jun 30, 2005.

  1. Hi,
    I'm getting the following message.when trying to connect to the server from
    my client...

    "No connection could be made as the server refused it".

    Here is my serverside code..
    TcpServerChannel tcp1 = new TcpServerChannel(49157);
    ChannelServices.RegisterChannel(tcp1);


    RemotingConfiguration.RegisterWellKnownServiceType(typeof(RemotableClass.DbConnect),"DbConnect",WellKnownObjectMode.SingleCall);

    Here is my client code...
    TcpClientChannel tcpClient = new TcpClientChannel();
    ChannelServices.RegisterChannel(tcpClient);

    RemotingConfiguration.RegisterWellKnownClientType(typeof(DbConnect),"tcp://10.236.230.117:49157/DbConnect");

    Here is my remotable object...

    public class DbConnect : MarshalByRefObject
    {
    public DataSet ExecuteQuery(string strQuery)
    {
    Console.Write("Starting to execute " +
    "the query...");
    // Create a SqlCommand object
    // to represent the query
    sqlConn.Open();
    SqlCommand sqlcmd =
    sqlConn.CreateCommand();
    sqlcmd.Connection = sqlConn;
    sqlcmd.CommandType = CommandType.Text;
    sqlcmd.CommandText = strQuery;
    // Create a SqlDataAdapter object
    // to talk to the database
    SqlDataAdapter sqlda = new SqlDataAdapter();
    sqlda.SelectCommand = sqlcmd;
    // Create a DataSet to hold the results
    DataSet ds = new DataSet();
    try
    {
    // Fill the DataSet
    sqlda.Fill(ds, "Results");
    }
    catch (Exception ex)
    {
    Console.WriteLine(ex.Message,
    "Error executing query");
    }
    Console.WriteLine("Done.");
    return ds;

    }}

    Can anyone help me out.???????/ it's urgent...........
    =?Utf-8?B?QVZM?=, Jun 30, 2005
    #1
    1. Advertising

  2. Does the server have a firewall installed? ie. Is the port you are using
    open?

    --
    - Paul Glavich
    MVP ASP.NET
    http://weblogs.asp.net/pglavich
    ASPInsiders member - http://www.aspinsiders.com


    "AVL" <> wrote in message
    news:...
    > Hi,
    > I'm getting the following message.when trying to connect to the server
    > from
    > my client...
    >
    > "No connection could be made as the server refused it".
    >
    > Here is my serverside code..
    > TcpServerChannel tcp1 = new TcpServerChannel(49157);
    > ChannelServices.RegisterChannel(tcp1);
    >
    >
    > RemotingConfiguration.RegisterWellKnownServiceType(typeof(RemotableClass.DbConnect),"DbConnect",WellKnownObjectMode.SingleCall);
    >
    > Here is my client code...
    > TcpClientChannel tcpClient = new TcpClientChannel();
    > ChannelServices.RegisterChannel(tcpClient);
    >
    > RemotingConfiguration.RegisterWellKnownClientType(typeof(DbConnect),"tcp://10.236.230.117:49157/DbConnect");
    >
    > Here is my remotable object...
    >
    > public class DbConnect : MarshalByRefObject
    > {
    > public DataSet ExecuteQuery(string strQuery)
    > {
    > Console.Write("Starting to execute " +
    > "the query...");
    > // Create a SqlCommand object
    > // to represent the query
    > sqlConn.Open();
    > SqlCommand sqlcmd =
    > sqlConn.CreateCommand();
    > sqlcmd.Connection = sqlConn;
    > sqlcmd.CommandType = CommandType.Text;
    > sqlcmd.CommandText = strQuery;
    > // Create a SqlDataAdapter object
    > // to talk to the database
    > SqlDataAdapter sqlda = new SqlDataAdapter();
    > sqlda.SelectCommand = sqlcmd;
    > // Create a DataSet to hold the results
    > DataSet ds = new DataSet();
    > try
    > {
    > // Fill the DataSet
    > sqlda.Fill(ds, "Results");
    > }
    > catch (Exception ex)
    > {
    > Console.WriteLine(ex.Message,
    > "Error executing query");
    > }
    > Console.WriteLine("Done.");
    > return ds;
    >
    > }}
    >
    > Can anyone help me out.???????/ it's urgent...........
    >
    Paul Glavich [MVP ASP.NET], Jun 30, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Abhishek
    Replies:
    0
    Views:
    1,905
    Abhishek
    Nov 16, 2003
  2. Karuppasamy

    Remoting Component --> Com+ Component:

    Karuppasamy, Jan 15, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    648
    Karuppasamy
    Jan 15, 2004
  3. Natalia DeBow

    C# Remoting/COM Security E_ACCESSDENIED error

    Natalia DeBow, May 6, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    2,431
    Natalia DeBow
    May 6, 2004
  4. jason
    Replies:
    0
    Views:
    521
    jason
    Jun 1, 2005
  5. Philip K
    Replies:
    0
    Views:
    124
    Philip K
    Jun 28, 2007
Loading...

Share This Page