[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Nathan

11/1/2004 12:54:00 AM

I read about the namespace for IPC is new in the 2.0 framework and have been
trying to implement it, but the client app keeps saying the "requested
service could not be found".
Essentially, I created a windows service that will act as the ipc server and
a client app that can call functions in the server. At the same time, the ipc
server can notify the client of a change.
I'm using an Interface between the two and from the client, I try to use
"Activator.GetObject" to the ipc://MyService that I registered in the windows
service.
It at least goes through that (though in debugging it can't view the
properties of a proxy). But the problem comes after when I try to access any
function in the interface to the server.
I have a function that will return a value, but instead it says that the
service couldn't be found at this point.
************
Dim RServer As New
Runtime.Remoting.Channels.Ipc.IpcServerChannel("MyService") 'server side
Function HelloWorld() As String
Return "Howdy Doody"
End Function 'server side

Public Interface MyServer_Interface
Function HelloWorld() As String
End Interface 'interface shared between client and server

Dim remoteObject As MyInterface.MyServer_Interface =
CType(Activator.GetObject(GetType(MyInterface.MyServer_Interface),
"ipc://MyService"), MyInterface.MyServer_Interface) 'client side
MsgBox remoteObject.HelloWorld() 'client side
************
Anyone with success with this?
Another thing I'd like to see is how Events could be implemented in this
interface. I said I would like the server to notify the client of a change so
the client can request to see the change and would expect I could use a
raiseevent on the server and have it reflect over to the client.

Thanks,
Nathan
3 Answers

Nathan

11/1/2004 6:54:00 PM

0

A few little changes showed the service is there, but not a method I would
choose to apply...
I changed Interface to a Class, set RegisterWellKnownServiceType and
RegisterWellKnownClientType and accessed a function in the class.

The reason I am liking Interfaces more is that it isn't the whole class
which I think can/ought to be kept only on the server (granted the machine is
the same, but thinking ahead).

Can the Interface be successfully implemented in an IPC remote scenario?

Thanks,
Nathan

"Nathan" wrote:

> I read about the namespace for IPC is new in the 2.0 framework and have been
> trying to implement it, but the client app keeps saying the "requested
> service could not be found".
> Essentially, I created a windows service that will act as the ipc server and
> a client app that can call functions in the server. At the same time, the ipc
> server can notify the client of a change.
> I'm using an Interface between the two and from the client, I try to use
> "Activator.GetObject" to the ipc://MyService that I registered in the windows
> service.
> It at least goes through that (though in debugging it can't view the
> properties of a proxy). But the problem comes after when I try to access any
> function in the interface to the server.
> I have a function that will return a value, but instead it says that the
> service couldn't be found at this point.
> ************
> Dim RServer As New
> Runtime.Remoting.Channels.Ipc.IpcServerChannel("MyService") 'server side
> Function HelloWorld() As String
> Return "Howdy Doody"
> End Function 'server side
>
> Public Interface MyServer_Interface
> Function HelloWorld() As String
> End Interface 'interface shared between client and server
>
> Dim remoteObject As MyInterface.MyServer_Interface =
> CType(Activator.GetObject(GetType(MyInterface.MyServer_Interface),
> "ipc://MyService"), MyInterface.MyServer_Interface) 'client side
> MsgBox remoteObject.HelloWorld() 'client side
> ************
> Anyone with success with this?
> Another thing I'd like to see is how Events could be implemented in this
> interface. I said I would like the server to notify the client of a change so
> the client can request to see the change and would expect I could use a
> raiseevent on the server and have it reflect over to the client.
>
> Thanks,
> Nathan

Nathan

11/2/2004 5:08:00 PM

0

Ok, a little more headway by finding out I don't need to use the
RegisterWellKnownClientType and am using Activator.GetObject instead.
Now it looks like there is chatter with the server service because it craps
out when I try to access the function from the client.

The client ends up saying the "underlying connection was closed" and when I
look in the System Log, it says my service unexpectedly shut down. I even try
to trap the error in the function and write to the log, but it never even has
a chance to write.

Nathan

"Nathan" wrote:

> A few little changes showed the service is there, but not a method I would
> choose to apply...
> I changed Interface to a Class, set RegisterWellKnownServiceType and
> RegisterWellKnownClientType and accessed a function in the class.
>
> The reason I am liking Interfaces more is that it isn't the whole class
> which I think can/ought to be kept only on the server (granted the machine is
> the same, but thinking ahead).
>
> Can the Interface be successfully implemented in an IPC remote scenario?
>
> Thanks,
> Nathan
>
> "Nathan" wrote:
>
> > I read about the namespace for IPC is new in the 2.0 framework and have been
> > trying to implement it, but the client app keeps saying the "requested
> > service could not be found".
> > Essentially, I created a windows service that will act as the ipc server and
> > a client app that can call functions in the server. At the same time, the ipc
> > server can notify the client of a change.
> > I'm using an Interface between the two and from the client, I try to use
> > "Activator.GetObject" to the ipc://MyService that I registered in the windows
> > service.
> > It at least goes through that (though in debugging it can't view the
> > properties of a proxy). But the problem comes after when I try to access any
> > function in the interface to the server.
> > I have a function that will return a value, but instead it says that the
> > service couldn't be found at this point.
> > ************
> > Dim RServer As New
> > Runtime.Remoting.Channels.Ipc.IpcServerChannel("MyService") 'server side
> > Function HelloWorld() As String
> > Return "Howdy Doody"
> > End Function 'server side
> >
> > Public Interface MyServer_Interface
> > Function HelloWorld() As String
> > End Interface 'interface shared between client and server
> >
> > Dim remoteObject As MyInterface.MyServer_Interface =
> > CType(Activator.GetObject(GetType(MyInterface.MyServer_Interface),
> > "ipc://MyService"), MyInterface.MyServer_Interface) 'client side
> > MsgBox remoteObject.HelloWorld() 'client side
> > ************
> > Anyone with success with this?
> > Another thing I'd like to see is how Events could be implemented in this
> > interface. I said I would like the server to notify the client of a change so
> > the client can request to see the change and would expect I could use a
> > raiseevent on the server and have it reflect over to the client.
> >
> > Thanks,
> > Nathan

Nathan

11/3/2004 4:16:00 PM

0

Ok, another test pointing towards a solution.
I thought I'd try a tcp channel instead of ipc and it ended up erring again,
but with a better description that said something along the lines or multiple
sockets being registered with the same port.
That got me thinking that when I declared the server variable as new and
global in the service, and then reference the service from the client, it
tries to register it again.
So I create it as new in the service start sub and it worked.
Tried it with ipc and it worked with that as well.

Nathan

"Nathan" wrote:

> Ok, a little more headway by finding out I don't need to use the
> RegisterWellKnownClientType and am using Activator.GetObject instead.
> Now it looks like there is chatter with the server service because it craps
> out when I try to access the function from the client.
>
> The client ends up saying the "underlying connection was closed" and when I
> look in the System Log, it says my service unexpectedly shut down. I even try
> to trap the error in the function and write to the log, but it never even has
> a chance to write.
>
> Nathan
>
> "Nathan" wrote:
>
> > A few little changes showed the service is there, but not a method I would
> > choose to apply...
> > I changed Interface to a Class, set RegisterWellKnownServiceType and
> > RegisterWellKnownClientType and accessed a function in the class.
> >
> > The reason I am liking Interfaces more is that it isn't the whole class
> > which I think can/ought to be kept only on the server (granted the machine is
> > the same, but thinking ahead).
> >
> > Can the Interface be successfully implemented in an IPC remote scenario?
> >
> > Thanks,
> > Nathan
> >
> > "Nathan" wrote:
> >
> > > I read about the namespace for IPC is new in the 2.0 framework and have been
> > > trying to implement it, but the client app keeps saying the "requested
> > > service could not be found".
> > > Essentially, I created a windows service that will act as the ipc server and
> > > a client app that can call functions in the server. At the same time, the ipc
> > > server can notify the client of a change.
> > > I'm using an Interface between the two and from the client, I try to use
> > > "Activator.GetObject" to the ipc://MyService that I registered in the windows
> > > service.
> > > It at least goes through that (though in debugging it can't view the
> > > properties of a proxy). But the problem comes after when I try to access any
> > > function in the interface to the server.
> > > I have a function that will return a value, but instead it says that the
> > > service couldn't be found at this point.
> > > ************
> > > Dim RServer As New
> > > Runtime.Remoting.Channels.Ipc.IpcServerChannel("MyService") 'server side
> > > Function HelloWorld() As String
> > > Return "Howdy Doody"
> > > End Function 'server side
> > >
> > > Public Interface MyServer_Interface
> > > Function HelloWorld() As String
> > > End Interface 'interface shared between client and server
> > >
> > > Dim remoteObject As MyInterface.MyServer_Interface =
> > > CType(Activator.GetObject(GetType(MyInterface.MyServer_Interface),
> > > "ipc://MyService"), MyInterface.MyServer_Interface) 'client side
> > > MsgBox remoteObject.HelloWorld() 'client side
> > > ************
> > > Anyone with success with this?
> > > Another thing I'd like to see is how Events could be implemented in this
> > > interface. I said I would like the server to notify the client of a change so
> > > the client can request to see the change and would expect I could use a
> > > raiseevent on the server and have it reflect over to the client.
> > >
> > > Thanks,
> > > Nathan