|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Creating a remotable object like DCOMDoes anyone know if it is possible to return an object from a remoting
interface and have it be usable with .NET? I am trying to accomplish what I used to do in DCOM where I would call a function on an interface and it would return a new remote object. I could then call functions on that new object. When I attempt this with .NET it complains that the object has no channel sink. When I looked into the .NET configuration settings, this scenerio didn't seem to fit the 3, SingleCall, SingleInstance, or Client Initiated. The closest one I could think of was Client Initiated but it is the server that creates the object. Any ideas? Is this just not possible with .NET? Thanks. Jayme Jayme,
In DCOM, AFAIR it is also the server who creates the object - an interface you are given is actually only a proxy (or stub, can't remember exactly which of them runs on the client side). Show quote "Jayme Pechan" <jayme.pec***@whitefeld.com> wrote in message news:OwiHaFC4GHA.600@TK2MSFTNGP05.phx.gbl... > Does anyone know if it is possible to return an object from a remoting > interface and have it be usable with .NET? I am trying to accomplish what > I used to do in DCOM where I would call a function on an interface and it > would return a new remote object. I could then call functions on that new > object. When I attempt this with .NET it complains that the object has no > channel sink. When I looked into the .NET configuration settings, this > scenerio didn't seem to fit the 3, SingleCall, SingleInstance, or Client > Initiated. The closest one I could think of was Client Initiated but it > is the server that creates the object. Any ideas? Is this just not > possible with .NET? > > Thanks. > > Jayme > Right, in DCOM, I create the object on the server and it marshals the
interface to the client which is a proxy because all calls to the object get marshalled to the server. The point though is that the client maintains a reference to a unique object on the server with its own state and such until it is released by the client. I need to find some way to do this same thing, if possible, in .NET. It looks like it is impossible. Thanks. Jayme Show quote "Dmytro Lapshyn [MVP]" <x-code@no-spam-please.hotpop.com> wrote in message news:OWqkh$I4GHA.696@TK2MSFTNGP03.phx.gbl... > Jayme, > > In DCOM, AFAIR it is also the server who creates the object - an interface > you are given is actually only a proxy (or stub, can't remember exactly > which of them runs on the client side). > > -- > Regards, > Dmytro Lapshyn [MVP] > http://blogs.vbcity.com/DmytroL > > "Jayme Pechan" <jayme.pec***@whitefeld.com> wrote in message > news:OwiHaFC4GHA.600@TK2MSFTNGP05.phx.gbl... >> Does anyone know if it is possible to return an object from a remoting >> interface and have it be usable with .NET? I am trying to accomplish >> what I used to do in DCOM where I would call a function on an interface >> and it would return a new remote object. I could then call functions on >> that new object. When I attempt this with .NET it complains that the >> object has no channel sink. When I looked into the .NET configuration >> settings, this scenerio didn't seem to fit the 3, SingleCall, >> SingleInstance, or Client Initiated. The closest one I could think of >> was Client Initiated but it is the server that creates the object. Any >> ideas? Is this just not possible with .NET? >> >> Thanks. >> >> Jayme >> > I've checked with MSDN docs and the Client Activation mode is just what you
need. To quote the "Client Activation" topic from MSDN's .NET Framework Developer's Guide: "Client-activated objects are objects whose lifetimes are controlled by the calling application domain, just as they would be if the object were local to the client. With client activation, a round trip to the server occurs when the client tries to create an instance of the server object, and the client proxy is created using an object reference (ObjRef) obtained on return from the creation of the remote object on the server. Each time a client creates an instance of a client-activated type, that instance will service only that particular reference in that particular client until its lease expires and its memory is recycled. If a calling application domain creates two new instances of the remote type, each of the client references will invoke only the particular instance in the server application domain from which the reference was returned. In COM, clients hold an object in memory by holding a reference to it. When the last client releases its last reference, the object can delete itself. Client activation provides the same client control over the server object's lifetime, but without the complexity of maintaining references or the constant pinging to confirm the continued existence of the server or client. Instead, client-activated objects use lifetime leases to determine how long they should continue to exist." Please refer to the whole topic for more information: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconclientactivation.asp Show quote "Jayme Pechan" <jayme.pec***@whitefeld.com> wrote in message news:uNdV2FL4GHA.4764@TK2MSFTNGP05.phx.gbl... > Right, in DCOM, I create the object on the server and it marshals the > interface to the client which is a proxy because all calls to the object > get marshalled to the server. The point though is that the client > maintains a reference to a unique object on the server with its own state > and such until it is released by the client. I need to find some way to > do this same thing, if possible, in .NET. It looks like it is impossible. > > Thanks. > > Jayme > > "Dmytro Lapshyn [MVP]" <x-code@no-spam-please.hotpop.com> wrote in message > news:OWqkh$I4GHA.696@TK2MSFTNGP03.phx.gbl... >> Jayme, >> >> In DCOM, AFAIR it is also the server who creates the object - an >> interface you are given is actually only a proxy (or stub, can't remember >> exactly which of them runs on the client side). >> >> -- >> Regards, >> Dmytro Lapshyn [MVP] >> http://blogs.vbcity.com/DmytroL >> >> "Jayme Pechan" <jayme.pec***@whitefeld.com> wrote in message >> news:OwiHaFC4GHA.600@TK2MSFTNGP05.phx.gbl... >>> Does anyone know if it is possible to return an object from a remoting >>> interface and have it be usable with .NET? I am trying to accomplish >>> what I used to do in DCOM where I would call a function on an interface >>> and it would return a new remote object. I could then call functions on >>> that new object. When I attempt this with .NET it complains that the >>> object has no channel sink. When I looked into the .NET configuration >>> settings, this scenerio didn't seem to fit the 3, SingleCall, >>> SingleInstance, or Client Initiated. The closest one I could think of >>> was Client Initiated but it is the server that creates the object. Any >>> ideas? Is this just not possible with .NET? >>> >>> Thanks. >>> >>> Jayme >>> >> > > That seems sensible but they require that the object be created from the
client (apparently). If its possible to do what I want, this would have to be the right one. Thanks for the suggestion. Jayme Show quote "Dmytro Lapshyn [MVP]" <x-code@no-spam-please.hotpop.com> wrote in message news:uGXDw4T4GHA.3400@TK2MSFTNGP04.phx.gbl... > I've checked with MSDN docs and the Client Activation mode is just what > you need. To quote the "Client Activation" topic from MSDN's .NET > Framework Developer's Guide: > > "Client-activated objects are objects whose lifetimes are controlled by > the calling application domain, just as they would be if the object were > local to the client. With client activation, a round trip to the server > occurs when the client tries to create an instance of the server object, > and the client proxy is created using an object reference (ObjRef) > obtained on return from the creation of the remote object on the server. > Each time a client creates an instance of a client-activated type, that > instance will service only that particular reference in that particular > client until its lease expires and its memory is recycled. If a calling > application domain creates two new instances of the remote type, each of > the client references will invoke only the particular instance in the > server application domain from which the reference was returned. > In COM, clients hold an object in memory by holding a reference to it. > When the last client releases its last reference, the object can delete > itself. Client activation provides the same client control over the server > object's lifetime, but without the complexity of maintaining references or > the constant pinging to confirm the continued existence of the server or > client. Instead, client-activated objects use lifetime leases to determine > how long they should continue to exist." > > Please refer to the whole topic for more information: > > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconclientactivation.asp > > > -- > Regards, > Dmytro Lapshyn [MVP] > http://blogs.vbcity.com/DmytroL > > "Jayme Pechan" <jayme.pec***@whitefeld.com> wrote in message > news:uNdV2FL4GHA.4764@TK2MSFTNGP05.phx.gbl... >> Right, in DCOM, I create the object on the server and it marshals the >> interface to the client which is a proxy because all calls to the object >> get marshalled to the server. The point though is that the client >> maintains a reference to a unique object on the server with its own state >> and such until it is released by the client. I need to find some way to >> do this same thing, if possible, in .NET. It looks like it is >> impossible. >> >> Thanks. >> >> Jayme >> >> "Dmytro Lapshyn [MVP]" <x-code@no-spam-please.hotpop.com> wrote in >> message news:OWqkh$I4GHA.696@TK2MSFTNGP03.phx.gbl... >>> Jayme, >>> >>> In DCOM, AFAIR it is also the server who creates the object - an >>> interface you are given is actually only a proxy (or stub, can't >>> remember exactly which of them runs on the client side). >>> >>> -- >>> Regards, >>> Dmytro Lapshyn [MVP] >>> http://blogs.vbcity.com/DmytroL >>> >>> "Jayme Pechan" <jayme.pec***@whitefeld.com> wrote in message >>> news:OwiHaFC4GHA.600@TK2MSFTNGP05.phx.gbl... >>>> Does anyone know if it is possible to return an object from a remoting >>>> interface and have it be usable with .NET? I am trying to accomplish >>>> what I used to do in DCOM where I would call a function on an interface >>>> and it would return a new remote object. I could then call functions >>>> on that new object. When I attempt this with .NET it complains that >>>> the object has no channel sink. When I looked into the .NET >>>> configuration settings, this scenerio didn't seem to fit the 3, >>>> SingleCall, SingleInstance, or Client Initiated. The closest one I >>>> could think of was Client Initiated but it is the server that creates >>>> the object. Any ideas? Is this just not possible with .NET? >>>> >>>> Thanks. >>>> >>>> Jayme >>>> >>> >> >> > |
|||||||||||||||||||||||