473,394 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Help in remoting !

MS
In my project I want to execute some commands on the remote machine. I am
using .Net Remoting to achieve this. My server which is an exe is copied on
the remote machine and it receives command from client which is executed by
the exe. I am facing problem while executing the exe on the remote machine.
If I start the exe manually everything works fine but if I execute it
remotely through code using WMI an exception is thrown saying "No connection
could be made because the target machine actively refused it". This
exception is generally thrown when the remote server is not running but the
task manager of the remote machine shows that the exe is running. I am
using Win32_process class to do this. The MSDN help of Win32_process class
Create() method says "For security reasons the Win32_Process.Create method
cannot be used to start an interactive process". Is this the reason for the
exception? If so, then what is the alternative for executing an exe on
remote machine?

I am pasting the code snippet of my client and server below

Code of Server:

RemotingConfiguration.Configure( "rpcserver.exe.config" );

TcpServerChannel channel = new TcpServerChannel(rs.mPort);

ChannelServices.RegisterChannel(channel);

RemotingConfiguration.RegisterWellKnownServiceType (

typeof(RemoteServerObject),

"ToolCommand",

WellKnownObjectMode.SingleCall);

Code for Client:

ManagementScope obScope = new ManagementScope("\\\\" + remoteServer +
"\\root\\CIMV2");

ManagementClass shareClass = new ManagementClass( "\\\\" + remoteServer +
"\\root\\CIMV2:Win32_Process" );

object[] param = {"c:\\temp\\rpcserver.exe",null,null,null};

object response = shareClass.InvokeMethod( "Create", param );

}
Nov 18 '05 #1
2 946
The error you are getting sounds like your server app is an interactive
application. Is this true? (Doesn't make sense to me).

I'd assume that your server would be implemented as a windows service or
started by a windows service. Is this the case?

? confused ?
--- Nick

"MS" <an*******@discussions.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
In my project I want to execute some commands on the remote machine. I am
using .Net Remoting to achieve this. My server which is an exe is copied on the remote machine and it receives command from client which is executed by the exe. I am facing problem while executing the exe on the remote machine. If I start the exe manually everything works fine but if I execute it
remotely through code using WMI an exception is thrown saying "No connection could be made because the target machine actively refused it". This
exception is generally thrown when the remote server is not running but the task manager of the remote machine shows that the exe is running. I am
using Win32_process class to do this. The MSDN help of Win32_process class
Create() method says "For security reasons the Win32_Process.Create method
cannot be used to start an interactive process". Is this the reason for the exception? If so, then what is the alternative for executing an exe on
remote machine?

I am pasting the code snippet of my client and server below

Code of Server:

RemotingConfiguration.Configure( "rpcserver.exe.config" );

TcpServerChannel channel = new TcpServerChannel(rs.mPort);

ChannelServices.RegisterChannel(channel);

RemotingConfiguration.RegisterWellKnownServiceType (

typeof(RemoteServerObject),

"ToolCommand",

WellKnownObjectMode.SingleCall);

Code for Client:

ManagementScope obScope = new ManagementScope("\\\\" + remoteServer +
"\\root\\CIMV2");

ManagementClass shareClass = new ManagementClass( "\\\\" + remoteServer +
"\\root\\CIMV2:Win32_Process" );

object[] param = {"c:\\temp\\rpcserver.exe",null,null,null};

object response = shareClass.InvokeMethod( "Create", param );

}

Nov 18 '05 #2
Hi,

can you put all channel and object registration code in try/catch block,
and make a logging in a local text file for every step performed and
possible exceptions?

Sunny
In article <#h**************@tk2msftngp13.phx.gbl>,
an*******@discussions.com says...
In my project I want to execute some commands on the remote machine. I am
using .Net Remoting to achieve this. My server which is an exe is copied on
the remote machine and it receives command from client which is executed by
the exe. I am facing problem while executing the exe on the remote machine.
If I start the exe manually everything works fine but if I execute it
remotely through code using WMI an exception is thrown saying "No connection
could be made because the target machine actively refused it". This
exception is generally thrown when the remote server is not running but the
task manager of the remote machine shows that the exe is running. I am
using Win32_process class to do this. The MSDN help of Win32_process class
Create() method says "For security reasons the Win32_Process.Create method
cannot be used to start an interactive process". Is this the reason for the
exception? If so, then what is the alternative for executing an exe on
remote machine?

I am pasting the code snippet of my client and server below

Code of Server:

RemotingConfiguration.Configure( "rpcserver.exe.config" );

TcpServerChannel channel = new TcpServerChannel(rs.mPort);

ChannelServices.RegisterChannel(channel);

RemotingConfiguration.RegisterWellKnownServiceType (

typeof(RemoteServerObject),

"ToolCommand",

WellKnownObjectMode.SingleCall);

Code for Client:

ManagementScope obScope = new ManagementScope("\\\\" + remoteServer +
"\\root\\CIMV2");

ManagementClass shareClass = new ManagementClass( "\\\\" + remoteServer +
"\\root\\CIMV2:Win32_Process" );

object[] param = {"c:\\temp\\rpcserver.exe",null,null,null};

object response = shareClass.InvokeMethod( "Create", param );

}

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Trokey | last post by:
Here's my setup: Component A: .NET exe acting as a .NET remoting server. The channel type is tcp. Component B: .NET assembly acting as a .NET remoting client with event handlers for server...
0
by: Henrik Nordgren | last post by:
Im trying to build a simple chat app... here is the code: server visual basic code:-------------------------------------------------------------------------------- Public Class ChatServer ...
0
by: bettervssremoting | last post by:
To view the full article, please visit http://www.BetterVssRemoting.com Better VSS Remote Access Tool This article makes a detailed comparison among SourceAnyWhere, SourceOffSite, VSS...
12
by: Mural Kumar via .NET 247 | last post by:
(Type your message here) -------------------------------- From: Mural Kumar Which is the best way to make a remoting server? 1)As a Windows service 2)As a simple exe, which will run in a...
1
by: Skip | last post by:
Hi, I get the following exception thrown when I try to run my code: "An unhandled exception of type 'System.Runtime.Serialization.SerializationException' occurred in mscorlib.dll Additional...
3
by: S.Creek | last post by:
Hi, I am trying to build a multi clients application with C# that will send and receive messages using a listener on a server, the computers are all on the same LAN, the listener need to...
3
by: Julia | last post by:
I need help with architecture design,please: I have a server which constantly downloading messages from the internet and store them inside a data base. the server have two administrators...
0
by: MS Newsgroups | last post by:
Hi, I am trying to get my head around remoting. I have managed to configure the samples on MSDN and that is working fine. I have now tried to build my own remoting application to test this and i...
7
by: Mat | last post by:
I am developping multi-user windows application. i use Access database. user edit, add and delete data from database. Request: when an item is deleted ,added or modified by an user, all others...
8
by: Raju Joseph | last post by:
Hi All, I am just trying to get an opinion here. I know this is always a tough choice to make. We are in the process of converting our VB6 based Healthcare Information System (a full-fledged...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.