Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remoting Marshal and Events

Status
Not open for further replies.

Borvik

Programmer
Jan 2, 2002
1,392
0
0
US
I'm attempting to build a Windows service from which I can manage it through a GUI on another computer using Remoting.

I have an Interface that is referenced both by the service, and the managing program.

In the service the interface is implemented in a class that inherits the MarshalByRefObject
Code:
Public Class clsSharedObject
    Inherits MarshalByRefObject
    Implements iMySharedObject

The service starts listening via the following:
Code:
Dim formatter As New BinaryServerFormatterSinkProvider
formatter.TypeFilterLevel = Runtime.Serialization.Formatters.TypeFilterLevel.Full

channel = New TcpServerChannel("RemChannelName", port, formatter)
ChannelServices.RegisterChannel(channel, False)
RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off
RemotingServices.Marshal(mgr, "MySharedObject")

In the client I am doing this to connect:
Code:
Dim formatter As New BinaryClientFormatterSinkProvider()
Dim channel As New TcpClientChannel("RemChannelName", formatter)
ChannelServices.RegisterChannel(channel, False)
manager = CType(Activator.GetObject(GetType(iMySharedObject), "tcp://192.168.102.3:9000/MySharedObject"), iMySharedObject)

AddHandler manager.ServiceStateChanged, AddressOf manager_ServiceStateChanged
The ServiceStateChanged event is defined in the interface - and the AddHandler line is also where I am having difficulty.

At that line I am getting the error like "Could not load file or assembly {0} or one of its dependencies. The system cannot find the file specified."

Most likely because the server service doesn't have access to the managing gui requesting the addhandler.

Any ideas on how I can get the client to subscribe to the events?

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top