-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
http://www.genuinechannels.com/Content.aspx?id=27&type=1 http://www.ingorammer.com/RemotingFAQ/USEINTERFACESWITHCONFIGFILES.htm l
All remoted objects MUST inherit from MarshalByRefObject if you want
to do things like use one of their methods as an event handler, even
though you use interfaces, the underlying object must be MBR.
Otherwise you either get an exception or a serialized instance when
you try to pass it over the network, given that all else is correct
anyway.
Is this your own framework or something 3rd party? (referring to
"IBroadcaster")
"Url" looks incorrect, if not for the "\" instead of "//" and the
inclusion of a servicename ("/SenderBroadcaster") it would be fine as
a callsite for UrlAttribute().
Are you sure you have a "wellknown" service object? You're using
GetObject not CreateInstance, and CreateInstance isn't something you
use for wellknown objects (SAOs).
:) "act" doesn't do anything, if the only thing you want is to get
messaging working consider looking at that first Url I provided. If
you need more knowledge on how to use interfaces to create objects
(and thus sample code to compare against the code you posted) see
that second Url. Also be aware that NAT and Firewall can affect your
ability to register objects for events. If you're using wellknown
objects note that I think they recycle every 5 minutes or so (dont
quote me) and also have async/MT contention problems, unless these
issues were addressed in the 1.1 release.
Hope that helps
- Shaun
[quoted text, click to view] "Shari" <sharipastore@yahoo.com> wrote in message
news:5935b2a0.0308210648.dd8120a@posting.google.com...
> Here is my code. The problem I'm having is that I'm not trying to
> register objects that inherit from MarshalByRefObject. The object
> is an interface to receive remoting events from the server. The
> CreateInstance doesn't work for interfaces and I'm not sure how
> else I can get events to work.
>
> private IBroadcaster[] _senderBroadcaster;
> private BroadcastEventWrapper _senderEventWrapper;
>
>
> string[] serverNames = new string[] { "localhost", "othermachine"
> };
>
> _senderEventWrapper = new BroadcastEventWrapper();
> _senderEventWrapper.FilesSentLocal += new
> FilesSentHandler(OnFilesSent);
> for( int ii = 0; ii < 2; ii++ )
> {
> string Url = "tcp:\\" + serverNames[ii] +
> ":8086\\SenderBroadcaster";
> System.Runtime.Remoting.Activation.UrlAttribute urlAttr =
> new System.Runtime.Remoting.Activation.UrlAttribute(Url);
>
> object [] act = {urlAttr};
> ObjectHandle objectHandle = null;
> objectHandle =
> (ObjectHandle)Activator.GetObject(typeof(IBroadcaster), Url);
> _senderBroadcaster[ii] = (IBroadcaster)objectHandle.Unwrap();
> _senderBroadcaster[ii].FilesSent +=
> new
> FilesSentHandler(_senderEventWrapper.LocallyHandleFilesSent); }
>
> Thanks,
>
> Shari
>
>
> "SEWilson" <elywilson@furtherdown.net> wrote in message
> news:<096401c3678f$f1a89f50$a101280a@phx.gbl>...
> > >A single server should only need to register all of its
> > >types and wait.
> >
> > At this point you might always want to establish peer to
> > peer connections with other known servers. If you do this
> > be very careful to wrap access to any peer servers with
> > try/catch blocks since you don't want the failure of a
> > local method to cause a server to go down.
> >
> > >Clients will need to connect to each server and provide a
> >
> > You can use Activator.CreateInstance() to create an object
> > from a specific server using the activationAttributes
> > argument and provide in it a UrlAttribute() to the uri of
> > your service.
> >
> >
http://msdn.microsoft.com/library/default.asp? > > url=/library/en-
> > us/cpref/html/frlrfSystemActivatorClassCreateInstanceTopic.
> > asp has an example of this. For reference, they are
> > connecting to "http://localhost:9000/MySampleService".
> >
> > >Hope that helps, please reply with your findings.
> > > - Shaun
> > >
> > >
> > >>-----Original Message-----
> > >>The goal is to have the identical servers running on
> > several different
> > >>machines while sending events to one client located on
> > one of the
> > >>machines. I can get remoting events to work for each
> > server
> > >>individually, but I'm not sure how to register multiple
> > URLs for each
> > >>server. I've tried using the Activator.CreateInstance
> > with each url
> > >>attribute, but it raises the exception "Activation
> > Attributes are not
> > >>supported for types not deriving from
> > MarshalByRefObject". Well I'm
> > >>trying to register an interface since I am using
> > remoting
> > events. Any
> > >>way to get this to work???
> > >>
> > >>Thanks in advance,
> > >>
> > >>Shari
> > >>.
> > >>
> > >.
-----BEGIN PGP SIGNATURE-----
Version: PGP 8.0.2
iQA/AwUBP0XZ5qZcqAh+utlREQK1XACgtQY1zdtb/2MqDoNgySCloLnkA0YAoMW4
tqYf7EsYl09dm+7k3I/LnOfe
=Kqf4
-----END PGP SIGNATURE-----