remoting error

G

Guest

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...........
 
P

Paul Glavich [MVP ASP.NET]

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

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,222
Members
46,809
Latest member
moe77

Latest Threads

Top