HighTechTalks DotNet Forums  

how to retrieve URL for remote object ???

Dotnet Framework (Remoting) microsoft.public.dotnet.framework.remoting


Discuss how to retrieve URL for remote object ??? in the Dotnet Framework (Remoting) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
calderara
 
Posts: n/a

Default how to retrieve URL for remote object ??? - 05-22-2007 , 04:30 AM






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>

Firs t of all is it the correct way to set it here as show ?
Second how to retrive the url part ?

thanks for help
regards
serge


Reply With Quote
  #2  
Old   
Tim Van Wassenhove
 
Posts: n/a

Default Re: how to retrieve URL for remote object ??? - 05-22-2007 , 11:31 AM






calderara schreef:
Quote:
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.IPer sonService,
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>

Quote:
Second how to retrive the url part ?
// load configuration from App.config
RemotingConfiguration.Configure(AppDomain.CurrentD omain.SetupInformation.ConfigurationFile,
false);

// get an instance
private static object GetService(string fullName)
{
// get all the configured types
WellKnownClientTypeEntry[] wellKnownClientTypeEntries =
RemotingConfiguration.GetRegisteredWellKnownClient Types();

foreach (WellKnownClientTypeEntry welknownClientTypeEntry in
wellKnownClientTypeEntries)
{
if (welknownClientTypeEntry.ObjectType.FullName == fullName)
{
return Activator.GetObject(welknownClientTypeEntry.Object Type,
welknownClientTypeEntry.ObjectUrl);
}
}
}
}

--
Tim Van Wassenhove - Read my mind <url:http://www.timvw.be/>


Reply With Quote
  #3  
Old   
calderara
 
Posts: n/a

Default Re: how to retrieve URL for remote object ??? - 05-22-2007 , 03:14 PM



Thnaks for your sample tim...I appreciate..

But one more question, why are you also specifing the WellKnown mode in your
client configuation ?

I have undertsood that this mode is specify on the server side !! For my
case I have specified singleton on my config file but at my server side.

under client config I did not specify any mode ...
Does it have really to be set in both side ?

An other thing why ar you seeting your end point with the .rem extension ?
this extension is used only if remote object is host under IIS right ?

regards
serge

"Tim Van Wassenhove" wrote:

Quote:
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.IPer sonService,
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.CurrentD omain.SetupInformation.ConfigurationFile,
false);

// get an instance
private static object GetService(string fullName)
{
// get all the configured types
WellKnownClientTypeEntry[] wellKnownClientTypeEntries =
RemotingConfiguration.GetRegisteredWellKnownClient Types();

foreach (WellKnownClientTypeEntry welknownClientTypeEntry in
wellKnownClientTypeEntries)
{
if (welknownClientTypeEntry.ObjectType.FullName == fullName)
{
return Activator.GetObject(welknownClientTypeEntry.Object Type,
welknownClientTypeEntry.ObjectUrl);
}
}
}
}

--
Tim Van Wassenhove - Read my mind <url:http://www.timvw.be/


Reply With Quote
  #4  
Old   
Tim Van Wassenhove
 
Posts: n/a

Default Re: how to retrieve URL for remote object ??? - 05-22-2007 , 04:46 PM



calderara schreef:
Quote:
Thnaks for your sample tim...I appreciate..

But one more question, why are you also specifing the WellKnown mode in your
client configuation ?
To be honest, i don't know how it ended up there (and no, it shouldn't
have been there).

Quote:
An other thing why ar you seeting your end point with the .rem extension ?
this extension is used only if remote object is host under IIS right ?
Well i copy-pasted from an example i had lying around, which hosted the
server in a webserver...



--
Tim Van Wassenhove - Read my mind <url:http://www.timvw.be/>


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.