Re: how to retrieve URL for remote object ???

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



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/>
.



Relevant Pages

  • RE: Need for programmatic config:timeToleranceInSeconds, MaxReques
    ... un-conventional - after such point when Excel has been redone in managed ... MaxReques ... application config file for our client DLL, that is invoked as an add-in to ... Our client group attempted this without success. ...
    (microsoft.public.dotnet.framework.webservices.enhancements)
  • RE: SV: [SLE] Citrix client on SuSE 9.0
    ... This looks more like a browser config issue ... Basically conqueror doesn't know to use the ica client for all ... Subject: SV: Citrix client on SuSE 9.0 ...
    (SuSE)
  • Re: Slow opening of files
    ... will post the IP config tomorrow when I can access a workstation, ... if they open the file via the Office App itself the file opens ... The client has a member server and the same ...
    (microsoft.public.windows.server.sbs)
  • Re: Accessing server resources from remotable object
    ... > Your remoting host is on the IIS server, so you can have the remote object ... > write to a physical path. ... > the virtual directory and http. ... > Use a naming convention specific to each client if you are going to expect ...
    (microsoft.public.dotnet.framework.remoting)
  • Bidirectional communications with .NET remoting
    ... I have a remote object that has a public delegate. ... BinaryServerFormatterSinkProvider serverProvider = new ... My client object uses ... client-side config file is not appropriately set in the config file. ...
    (microsoft.public.dotnet.framework.remoting)