Re: Windows Service using remoting
From: Sunny (sunny_at_newsgroups.nospam)
Date: 07/13/04
- Next message: Harold: "Erratic System.NullReferenceException"
- Previous message: Michael Giagnocavo [MVP]: "Re: Security error ?"
- In reply to: Chuck Douglas: "Re: Windows Service using remoting"
- Next in thread: Chuck Douglas: "Re: Windows Service using remoting"
- Reply: Chuck Douglas: "Re: Windows Service using remoting"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 13 Jul 2004 13:28:45 -0500
Both the server and the client have to have access to the assembly in
which the object is declared. As it is not good to have your object code
distributed with the client, you can use:
1. soapsuds.exe utility to extract the meta-data info, and distribute
only this metadata. There are some problems with the this utility, and
some limitation.
thats why I usually recommend:
2. Interfaces or abstract class libraries. Allen Andersons article about
abstract class approach is very good. You can use the same with
interfaces as well:
http://www.glacialcomponents.com/ArticleDetail.aspx?
articleID=RemoteObject
Sunny
In article <uYgrWPPaEHA.2296@TK2MSFTNGP10.phx.gbl>, cdouglas@mapinfo.com
says...
> Ooops. Here is the error that I am getting.
>
> Unhandled Exception: System.IO.FileNotFoundException: File or assembly name
> Obje
> ctModel, or one of its dependencies, was not found.
> File name: "ObjectModel"
> at Client1.Client1.Main(String[] args)
>
> === Pre-bind state information ===
> LOG: DisplayName = ObjectModel, Version=1.0.1654.20166, Culture=neutral,
> PublicK
> eyToken=5fa67588008b079e
> (Fully-specified)
> LOG: Appbase = F:\download\
> LOG: Initial PrivatePath = NULL
> Calling assembly : Client1, Version=1.0.1654.20415, Culture=neutral,
> PublicKeyTo
> ken=null.
> ===
>
> LOG: Publisher policy file is not found.
> LOG: Host configuration file not found.
> LOG: Using machine configuration file from
> F:\WINDOWS\Microsoft.NET\Framework\v1
> .1.4322\config\machine.config.
> LOG: Post-policy reference: ObjectModel, Version=1.0.1654.20166,
> Culture=neutral
> , PublicKeyToken=5fa67588008b079e
> LOG: Attempting download of new URL file:///F:/download/ObjectModel.DLL.
> LOG: Attempting download of new URL
> file:///F:/download/ObjectModel/ObjectModel.
> DLL.
> LOG: Attempting download of new URL file:///F:/download/ObjectModel.EXE.
> LOG: Attempting download of new URL
> file:///F:/download/ObjectModel/ObjectModel.
> EXE.
>
> "Chuck Douglas" <cdouglas@mapinfo.com> wrote in message
> news:%23GwspNPaEHA.808@tk2msftngp13.phx.gbl...
> > I am having a problem with using remoting and I am hoping someone might
> > have run into this problem before.
> >
> > I have developed a Windows service, which has the following OnStart
> method
> > override.
> >
> > protected override void OnStart(string[] args)
> > {
> > TcpChannel channel = new TcpChannel(8085);
> > ChannelServices.RegisterChannel(channel);
> > RemotingConfiguration.RegisterWellKnownServiceType(
> > Type.GetType("ObjectModel.Engine,ObjectModel"),
> > "TestEngine", WellKnownObjectMode.Singleton);
> > }
> >
> > As you can see from the code above, I have a server object called
> > "ObjectModel.Engine". It is derived from MarshalByRefObject. This is
> built
> > into a DLL called ObjectModel.dll. It is one simple class which a very
> > simple interface, which I want to call remotely.
> >
> > I also have a client application, which has the following code. It
> uses
> > Activator.GetObject to get the proxy and calls the interface of the
> > ObjectModel.Engine object.
> >
> > [STAThread]
> > static void Main(string[] args)
> > {
> > TcpChannel channel = new TcpChannel();
> > ChannelServices.RegisterChannel(channel);
> > ObjectModel.Engine obj = (ObjectModel.Engine) Activator.GetObject(
> > typeof(ObjectModel.Engine),
> > "tcp://chdougla:8085/TestEngine");
> >
> > string prefix = args[0];
> > if (obj != null)
> > {
> > obj.Add(prefix + "fred");
> > System.Console.WriteLine(obj.ToStr());
> > }
> > else
> > {
> > System.Console.WriteLine("Could not locate server - ");
> > }
> > }
> >
> > I can successfully run the client and server on the same machine. I
> have
> > debugged into the windows service process id to verify that I was really
> > executing the remote code. However, when I try to put the client exe on
> > another machine then I get the following error. It seems like a
> > security/permissions problem, but I am not sure.
> >
> > Also, here are some followup questions. When I run the client exe, why
> > is my ObjectModel.dll automatically downloaded from the server? Is this
> > expected, as part of remoting? Is this a proxy dll or the real dll? When
> I
> > physically copy the ObjectModel.dll to the same directory as the client
> exe,
> > on another machine, things seem to work fine. I wouldn't expect that I
> > would have to copy the server dll on every client machine though?
> >
> > Any help anyone can provide would be very much appreciated.
> >
> > Thanks
> >
> >
>
>
>
- Next message: Harold: "Erratic System.NullReferenceException"
- Previous message: Michael Giagnocavo [MVP]: "Re: Security error ?"
- In reply to: Chuck Douglas: "Re: Windows Service using remoting"
- Next in thread: Chuck Douglas: "Re: Windows Service using remoting"
- Reply: Chuck Douglas: "Re: Windows Service using remoting"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|