Re: how to retrieve URL for remote object ???
- From: Tim Van Wassenhove <timvw@xxxxxxxxxxxxxxxx>
- Date: Tue, 22 May 2007 17:31:44 +0200
calderara schreef:
Dear all,
I have build a remote object host in a windows service. Everything work fine when the client call the remote object.
Now I try to make the client part more configurable in the sense that I would like to not hard coded the URl pass to the Activator.GetObject
For that I have added a client entry in my Client application config file as follow :
<client>
<wellknown
type="Maillefer.Remote.Data.Event,EventStorage"
url="tcp://localhost:8090/Event"
/>
</client>
(Under the assumption that client is under configuration > system.runtime.remoting > application it seems ok, )
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.runtime.remoting>
<application>
<client>
<wellknown mode="SingleCall" type="Be.TimVanWassenhove.Demo.PersonContract.IPersonService, PersonContract" url="http://localhost:2849/PersonService.rem"/>
</client>
<channels>
<channel ref="http" useDefaultCredentials="true">
<clientProviders>
<formatter ref="binary"/>
</clientProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>
</configuration>
Second how to retrive the url part ?
// load configuration from App.config RemotingConfiguration.Configure(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile, false);
// get an instance
private static object GetService(string fullName)
{
// get all the configured types
WellKnownClientTypeEntry[] wellKnownClientTypeEntries = RemotingConfiguration.GetRegisteredWellKnownClientTypes();
foreach (WellKnownClientTypeEntry welknownClientTypeEntry in wellKnownClientTypeEntries)
{
if (welknownClientTypeEntry.ObjectType.FullName == fullName)
{
return Activator.GetObject(welknownClientTypeEntry.ObjectType, welknownClientTypeEntry.ObjectUrl);
}
}
}
}
--
Tim Van Wassenhove - Read my mind <url:http://www.timvw.be/>
.
- Follow-Ups:
- Re: how to retrieve URL for remote object ???
- From: calderara
- Re: how to retrieve URL for remote object ???
- Prev by Date: Re: Remoting Questions
- Next by Date: Re: how to retrieve URL for remote object ???
- Previous by thread: AuthenticationException when calling a method on the proxy to a distant server - URGENT
- Next by thread: Re: how to retrieve URL for remote object ???
- Index(es):
Relevant Pages
|