473,773 Members | 2,277 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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:

<configuratio n>
<system.runtime .remoting>
<application>
<service>
<wellknown mode="Singleton "
type="RemoteHan dler, RemoteObject"
objectUri="Remo teHandler" />
</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:

<configuratio n>
<system.runtime .remoting>
<application>
<client>
<wellknown
type="RemoteHan dler, 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)
{
RemotingConfigu ration.Configur e("C:\\EazyRemo ting\\Client\\C lient.con
fig");
IEazyRemoting service = (IEazyRemoting) Activator.GetOb ject(
typeof(IEazyRem oting),
"tcp://127.0.0.1:8085/RemoteHandler") ;
if(service == null)
Console.WriteLi ne("here");
Console.WriteLi ne(service.GetP rod(2,3));
Console.ReadLin e();
}
}

}
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 2857
In article <Ol************ **@TK2MSFTNGP11 .phx.gbl>,
na*******@hotma il.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
2561
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 it's buisness. My problem is all the resources I have found aren't very clear on these things. All of them open the file then check to see if the stream is open. Well, the problem with using file.open("filename.dat", ios::in | ios::binary) is...
2
2091
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
5769
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). Unfortunately, I can't figure out how to read this from the server side code behind file (either vb or c#). Can anyone post some sample code for this. Thanks, Martin
10
9471
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 ConfigurationErrorException whenever I do the following: 1. Modify and save the section in code using the System.Configuration.Configuration.Save(). 2. Refresh teh section using ConfigurationManager.RefreshSection 3. Encrypt the section,...
0
1313
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 application configuration file to provide it with sensitive information. In this case, the application is talking to a website that requires credentials that are not the same as the user that the application runs as (again, its installed as a service).
0
4005
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, but my department has a couple of web servers of our own that are part of my organization's domain. I am trying to read LDAP information on my organization's domain controller from a web application on one of my department's servers. I have been...
0
8186
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 I'm not able read the property defined under this section. those are like this User Settings -Testing Application Settings -Test
3
3866
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 app.config). The only configuration reading I have used before is AppSettings and I have also used Spring Framework. It is more the type of configuration that Spring uses I am looking at now.
1
2591
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" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection, Microsoft.Practices.EnterpriseLibrary.Common, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> </configSections> <enterpriseLibrary.ConfigurationSource...
0
9621
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10106
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9914
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8937
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7463
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5355
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3610
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.