473,395 Members | 1,527 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,395 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 );

}
Jul 21 '05 #1
2 1603
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 );

}

Jul 21 '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 );

}

Jul 21 '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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.