Help in remoting !

M

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 );

}
 
N

Nick Malik

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
 
S

Sunny

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
 

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

Similar Threads

Remoting 1
Remoting Problem 15
When deployed to Heroku, python setup.py egg info did not run successfully. 1
ASP.NET + Remoting 3
Help in hangman game 1
Remoting crashes IIS 0
remoting error 1
.Net Remoting 1

Staff online

Members online

Forum statistics

Threads
473,992
Messages
2,570,220
Members
46,805
Latest member
ClydeHeld1

Latest Threads

Top