473,396 Members | 1,853 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Reading Configuration file

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
1 2815
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Daniel Moree | last post by:
I'm working on a program that must first establish if the file exists in the program directory then it must open if for reading, read each line and set the variables then the program goes on about...
2
by: jassi | last post by:
Hi, i have an app.config file as follows : <?xml version="1.0" encoding="utf-8"> <configuration> <appSettings> <add key="button1.Text" value="cc1"/>
8
by: Martin Eyles | last post by:
Hi, I have a configuration file I made in xml which I am using to name a database server. (this way I can deploy my web page on various servers, and just change this file to make it work)....
10
by: Ryan | last post by:
I've created a custom configuration section that inherits (naturally) from System.Configuration.ConfigurationSection. The configuration section is working 99% fine, however I keep coming across a...
0
by: crackajaxx | last post by:
I've hunted for a while so I'm hoping someone can shed some light on this problem for me. I have an application (not a web-app, in fact this is an installed service) that relies upon its...
0
by: tmsprowl | last post by:
Greetings! I was wondering if someone could help me with a problem I'm having. My department is just one of many within my organization. My organization has control over the network domain,...
0
by: Lucky | last post by:
Hi guys, I've got a problem under reading settlings from App.config file. I've used System.Configuration to reach to the "User Settings" and "Application Settings" sections. the problem is now...
3
by: Peter K | last post by:
Hi I need to be able to supply some relatively complex configuration to an application. The application will either run in a web context (with a web.config file, or as a application with an...
1
by: MasterLalit | last post by:
Hi, i am using a app.config file in my console application. App.config code--> <configuration> <configSections> <section name="enterpriseLibrary.ConfigurationSource"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.