Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   remoting error (http://www.velocityreviews.com/forums/t105616-remoting-error.html)

=?Utf-8?B?QVZM?= 06-30-2005 05:41 AM

remoting error
 
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",Well KnownObjectMode.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] 06-30-2005 11:24 AM

Re: remoting error
 
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" <AVL@discussions.microsoft.com> wrote in message
news:593A945D-1C1D-4740-8BD4-91EB74AB0DBA@microsoft.com...
> 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",Well KnownObjectMode.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...........
>





All times are GMT. The time now is 07:14 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.