Sunny
6/17/2004 2:25:00 PM
You are declaring yout object as SingleCall, which means that on every
invocation a new object is created. And ... no one has set the property.
You do not need RegisterWellKnown..., Marshal is what you need. Now in
your code you are exposing 2 objects on the same Uri, and I can not tell
you which one will take precedence.
Your VS AddIn code should be:
HttpServerChannel channel = new HttpServerChannel(8080);
ChannelServices.RegisterChannel(channel);
SmartSpecRemoteObject remObj = new SmartSpecRemoteObject();
remObj.CurrentSolution = this.applicationObject.Solution;
ObjRef ref1 = RemotingServices.Marshal(remObj, "remoteObjectUri", typeof
(SmartSpecRemoteObject));
Sunny
In article <bff5fc22.0406170223.19e62624@posting.google.com>,
mail@kaihuener.de says...
> Hallo,
>
> I have a problem by using .NET Remote, allthough it is quit good
> documented. I have 2 AddIns, one in MS Word 2003 and the other in
> VisualStudio and I''d like to create an remoteObjekt in VisualStudio
> from Word to use it in Word - so it is a simple Remote Call over an
> application domain.
>
> I tried this:
>
> Here is the code of my RemoteObject:
>
> using System;
> using EnvDTE;
>
> public class SmartSpecRemoteObject : MarshalByRefObject
> {
> private Solution currentSolution;
>
> public SmartSpecRemoteObject()
> {
> }
>
> public Solution GetSolution()
> {
> return this.currentSolution;
> }
>
> #region Properties
>
> public Solution CurrentSolution
> {
> get { return this.currentSolution; }
> set { this.currentSolution = value; }
> }
>
> #endregion
> }
>
> --------------------------------------------------------
>
> relevant Code of VS AddIn:
>
> HttpServerChannel channel = new HttpServerChannel(8080);
> ChannelServices.RegisterChannel(channel);
>
> RemotingConfiguration.RegisterWellKnownServiceType(typeof(SmartSpecRemoteObject),
> "remoteObjectUri", WellKnownObjectMode.SingleCall);
>
> SmartSpecRemoteObject remObj = new SmartSpecRemoteObject();
>
> remObj.CurrentSolution = this.applicationObject.Solution;
> ObjRef ref1 = RemotingServices.Marshal(remObj, "remoteObjectUri");
>
> --------------------------------------------------------
>
> and the relevant code of th CLient Word AddIn:
>
> HttpClientChannel channel = new HttpClientChannel();
> ChannelServices.RegisterChannel(channel);
>
> SmartSpecRemoteObject remoteObject =
> (SmartSpecRemoteObject)Activator.GetObject(typeof(SmartSpecRemoteObject),
> "http://localhost:8080/remoteObjectUri");
>
> My Problem is, the property I create in VS is not sent to Word. Also
> it could be, that in Word there is a new Object without the Property
> created. I don''t know, but there is no remoteObject.CurrentSollution
> in Word, and to have this was my aim to to all this remote stuff!
>
> Perhaps someone of you has an idea to help me to get a curent
> VisaulStudio Solution to Word,
>
> Thank you,
> Kai
>