[Mono-list] Re: mono-service
Robert Jordan
robertj at gmx.net
Tue Nov 1 10:47:58 EST 2005
Peter,
> What you say is true for Console servers in Windows and for normal executable assemblies, but not - according to the documentation I have read - for Services. Here is the relevant quotation from David Conger, "Remoting with C# and .NET", (2003), Wiley, pp209-210:
>
> "Next, the OnStart() method calls RemotingConfiguration.Configure() to publish the [remote object] ... as a remote object ... The startup directory for any Windows Service is:
>
> <OS drive>:<OS Dir>\system32
OnStart doesn't call RemotingConfiguration.Configure(). It must be
a sample from that book doing so.
> Ingo Rammer, "Advanced .NET Remoting in VB.NET", (2002), Apress, p115 says:
>
> "When using configuration files with Windows services, those files have to be placed in <%WINDIR%>\System32 (normally c:\winnt\system32) to be readable by the application, as this is the service's startup directory."
It is true that the working directory of a service is system32.
Hoewever, Rammer's advice to put the remoting into system32 is
pretty weird.
> Other published sources say the same thing. Are you sure this is not the case?
>
> In fairness, Rammer does give a way of using the application's installation directory by using code like this:
>
> RemotingConfiguration.Configure(
> AppDomain.CurrentDomain.SetupInformation.ConfigurationFile)
>
> I haven't tried that though, and I'd rather not if I don't have to because I don't understand it :(
You should use that. If simply loads the remoting configuration
from the app.exe.config of your app, regardless of the current
directory.
Rob
More information about the Mono-list
mailing list