Hi,
You don't need to use Reflection.
If you don't want the Remoting server in the Windows Service Project
(simplest approach), then you can create another project that contains the
actual Windows Service implementation:
Windows Service Project
References: RobotsService Project (new)
References: Remoting Project
class Service : ServiceBase
{
private RobotsService robotsService;
private RemoteServer remotingServer;
protected override void OnStart(string[] args)
{
robotsService = new RobotsService();
robotsService.Start();
// TODO: remoting config
remotingServer = new RemoteServer();
remotingServer.Start(robotsService);
}
}
Remoting Project
References: RobotsService Project (new)
public class RemoteServer : MarshalByRefObject
{
private RobotsService service;
public void Start(RobotsService service)
{
this.service = service;
}
public Point GetRobotPosition(int robotNo)
{
return service.GetRobotPosition(robotNo);
}
}
RobotsService Project (new project)
References: None
public class RobotsService
{
public void Start()
{
// actual service implementation
}
public Point GetRobotPosition(int robotNo)
{
return Point.Empty;
}
}
--
Dave Sexton
<ny***********@gmail.comwrote in message
news:11**********************@f1g2000cwa.googlegro ups.com...
The service is controlling some robots. They are moving very fast and
the windows service keeps track of where they are, and avoids
collisions. I want to create a web-page where you can see all the robot
positions. To make this possible i make a remoting service whit one
method GetRobotPosition(int robotNo). This method is calling a similar
method in the windows service to get the position of the robot. The web
page, which is a seperate project, is connecting to the remoting server
and calls GetRobotPosition. The remoting server needs to know about the
windows service to get the position of the robots, and the windows
service need to know about the remoting server to be able to start/stop
it. Can someone give me a concrete example on how to solve this. I want
my code to be easy to read. Maybe the simplest solution is just to
merge the windows service and the remoting server into one assembly,
but I don't want to do that as it shouldn't be necessary. If anyone can
show me how to solve this using reflection i would be very happy.
Thank you!
DeveloperX skrev:
>I think you've hit the nail on the head, it certainly sounds like a
design issue. I need a little more detail though. What in the service
does the remoting library require? Could you perhaps resolve the
dependency by creating a new class in the remoting library that the
host can populate with session d<<ata and that can raise events, that
sort of thing?