[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.remoting

Remote Object Not Found When Service Installed with Setup Project

Jim Davis

7/31/2004 12:38:00 AM

I have a simple remote object that is hosted in a Windows Service. I
register the WellKnownType via the services app.config file. I look up the
path to that file using
Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), then pass
that to RemotingConfiguration.Configure(path).

It all works fine when I install the Windows service using InstallUtil, but
when I create a Setup Project for the service I get a "File or assembly name
XX, or one of its dependencies, was not found."

The remote object is available - I have a test harness that can invoke it
directly with no errors. The app.Config file is visible to the service, as
I can read other keys from app settings. I have trace code that writes the
path of the file used in RemotingConfiguration.Configure() to the EventLog,
and it is correct.

I do not want to put the config file in system32, I want it next to the
service exe. Is there a way of doing this?

My config section and Activator.GetObject call are below.

Thanks,

Jim


My config section is:

<system.runtime.remoting>
<application name="RatingEngineService">
<service>
<wellknown type="Comp.RatingEngineRemote.IIE_Statement,
RatingEngineRemote"
objectUri="RatingEngineRemote"
mode="Singleton" />
</service>
<channels>
<channel ref="tcp" port="9999">
<serverProviders>
<formatter ref="binary" />
</serverProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>


The objects are invoked with the following code.

IIIE_Statement stmt = (IIIE_Statement)Activator.GetObject(
typeof(Comp.IRatingEngineRemote.IIIE_Statement),
tcp://server:9999/RatingEngineRemote);




2 Answers

Sam Santiago

7/31/2004 12:49:00 AM

0

Try something simpler when setting the configuration path as a test. Try
something like:

RemotingConfiguration.Configure(AppDomain.CurrentDomain.FriendlyName +
".config")

or simply hard coding it as a test:

RemotingConfiguration.Configure("myservice.exe.config")



Thanks,


Sam


--
_______________________________
Sam Santiago
ssantiago@n0spam-SoftiTechture.com
http://www.SoftiTe...
_______________________________
"Jim Davis" <jim.davis@flexcar.com> wrote in message
news:ePtPaapdEHA.3392@tk2msftngp13.phx.gbl...
> I have a simple remote object that is hosted in a Windows Service. I
> register the WellKnownType via the services app.config file. I look up
the
> path to that file using
> Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), then pass
> that to RemotingConfiguration.Configure(path).
>
> It all works fine when I install the Windows service using InstallUtil,
but
> when I create a Setup Project for the service I get a "File or assembly
name
> XX, or one of its dependencies, was not found."
>
> The remote object is available - I have a test harness that can invoke it
> directly with no errors. The app.Config file is visible to the service,
as
> I can read other keys from app settings. I have trace code that writes
the
> path of the file used in RemotingConfiguration.Configure() to the
EventLog,
> and it is correct.
>
> I do not want to put the config file in system32, I want it next to the
> service exe. Is there a way of doing this?
>
> My config section and Activator.GetObject call are below.
>
> Thanks,
>
> Jim
>
>
> My config section is:
>
> <system.runtime.remoting>
> <application name="RatingEngineService">
> <service>
> <wellknown type="Comp.RatingEngineRemote.IIE_Statement,
> RatingEngineRemote"
> objectUri="RatingEngineRemote"
> mode="Singleton" />
> </service>
> <channels>
> <channel ref="tcp" port="9999">
> <serverProviders>
> <formatter ref="binary" />
> </serverProviders>
> </channel>
> </channels>
> </application>
> </system.runtime.remoting>
>
>
> The objects are invoked with the following code.
>
> IIIE_Statement stmt = (IIIE_Statement)Activator.GetObject(
> typeof(Comp.IRatingEngineRemote.IIIE_Statement),
> tcp://server:9999/RatingEngineRemote);
>
>
>
>


Jim Davis

8/3/2004 5:39:00 PM

0

False alarm.

The problem was that my remote assembly was in the gac, and my config file
did not specify version, culture and public key info for the <wellknown>
type attribute. All prior testing had been done with the service.exe in the
same folder as the remote object's dll, so it was finding it. When the
service.exe was installed from another folder, even using InstallUtil.exe, I
got the same error.



"Jim Davis" <jim.davis@flexcar.com> wrote in message
news:ePtPaapdEHA.3392@tk2msftngp13.phx.gbl...
> I have a simple remote object that is hosted in a Windows Service. I
> register the WellKnownType via the services app.config file. I look up
the
> path to that file using
> Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), then pass
> that to RemotingConfiguration.Configure(path).
>
> It all works fine when I install the Windows service using InstallUtil,
but
> when I create a Setup Project for the service I get a "File or assembly
name
> XX, or one of its dependencies, was not found."
>
> The remote object is available - I have a test harness that can invoke it
> directly with no errors. The app.Config file is visible to the service,
as
> I can read other keys from app settings. I have trace code that writes
the
> path of the file used in RemotingConfiguration.Configure() to the
EventLog,
> and it is correct.
>
> I do not want to put the config file in system32, I want it next to the
> service exe. Is there a way of doing this?
>
> My config section and Activator.GetObject call are below.
>
> Thanks,
>
> Jim
>
>
> My config section is:
>
> <system.runtime.remoting>
> <application name="RatingEngineService">
> <service>
> <wellknown type="Comp.RatingEngineRemote.IIE_Statement,
> RatingEngineRemote"
> objectUri="RatingEngineRemote"
> mode="Singleton" />
> </service>
> <channels>
> <channel ref="tcp" port="9999">
> <serverProviders>
> <formatter ref="binary" />
> </serverProviders>
> </channel>
> </channels>
> </application>
> </system.runtime.remoting>
>
>
> The objects are invoked with the following code.
>
> IIIE_Statement stmt = (IIIE_Statement)Activator.GetObject(
> typeof(Comp.IRatingEngineRemote.IIIE_Statement),
> tcp://server:9999/RatingEngineRemote);
>
>
>
>