By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,640 Members | 1,581 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,640 IT Pros & Developers. It's quick & easy.

Reading Configuration file

P: n/a
I have this problem with .NET remoting:

my remote class is called RemoteHandler which implements an interface
called IEazyRemoting which has only one method to be implemented which
is [GetSum(int x,int y)] my server configuration file looks like this:

<configuration>
<system.runtime.remoting>
<application>
<service>
<wellknown mode="Singleton"
type="RemoteHandler, RemoteObject"
objectUri="RemoteHandler" />
</service>
<channels>
<channel port="8085" ref="tcp" />
</channels>
</application>
</system.runtime.remoting>
</configuration>

The point of using an interface is that i only supply the client that
interface and not the concrete code of RemoteHandler so the Client
configuration file looks like this:

<configuration>
<system.runtime.remoting>
<application>
<client>
<wellknown
type="RemoteHandler, RemoteObject"
url="http://127.0.0.1:8085/RemoteHandler"
/>
</client>
<channels>
<channel ref="tcp" port="8086" />
</channels>
</application>
</system.runtime.remoting>
</configuration>

now my client code to start a remote object and call the public method
GetSum, is like this:

namespace Client
{
public class Client
{

public static void Main(string[] Args)
{
RemotingConfiguration.Configure("C:\\EazyRemoting\ \Client\\Client.con
fig");
IEazyRemoting service = (IEazyRemoting)Activator.GetObject(
typeof(IEazyRemoting),
"tcp://127.0.0.1:8085/RemoteHandler");
if(service == null)
Console.WriteLine("here");
Console.WriteLine(service.GetProd(2,3));
Console.ReadLine();
}
}

}
so the problem here is that i mentioned the Url of the remote object
twice at the client side , one in the config file and the other is in
the client code what i want is not write the same url in the client code
but import the Url from the config file say by reading it from the
config file so how can i do that ? is there a better way of doing it
instead may be?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 15 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
In article <Ol**************@TK2MSFTNGP11.phx.gbl>,
na*******@hotmail.com says...
the problem here is that i mentioned the Url of the remote object
twice at the client side , one in the config file and the other is in
the client code what i want is not write the same url in the client code
but import the Url from the config file say by reading it from the
config file so how can i do that ? is there a better way of doing it
instead may be?


See if this article helps:

http://www.ingorammer.com/RemotingFA...NFIGFILES.html

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
Nov 15 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.