Groups | Blog | Home
all groups > dotnet remoting > june 2005 >

dotnet remoting : remoting error



AVL
6/29/2005 10:41:03 PM
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...........
peter
6/30/2005 6:31:12 PM
[quoted text, click to view]

You don't say what sort of host you have for your remote object
(executable, IIS, Windows service), so it's hard to tell what's going
on. However the most likely answer is that you do not have a server on
the machine identified by IP address 10.236.230.117 listening on port 49157.

Have you tried to get it working on localhost before deploying it to a
remote server?

I notice you're implementing code from Amit and Priti Kalani's MCAD/MCSD
book. Have you gone through the step-by-step? Which one are you trying
to do?

Cheers


Mikey_N
7/6/2005 7:11:03 AM
This may also be caused by a firewall or other security mechanism on the
server that is blocking requests on that port. You might try turning off IIS
on the server and running through port 80 - if that works it is probably a
security restriction on the other port.

[quoted text, click to view]
AddThis Social Bookmark Button