471,350 Members | 2,036 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Can I use a variable in an app.config file?


I have the config file below.

Is there anyway for the value of MachineName to be populated,
automatically, with the IP address that the application is running on?

So, I would say something like machineName=@IPAddress or some such thing...


<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.runtime.remoting>
<application>
<client>
<wellknown
type="ChatCenter, ChatCenter"
url="http://192.168.1.59:8080/Chat"
/>
</client>
<channels>
<!-- The "0" port is declared to allow remoting to choose -->
<!-- the most appropriate channel. You must specify a
channel -->
<!-- here, however; if you do not do so, your ChatClient -->
<!-- will not be listening for the call back from the -->
<!-- ChatCoordinator object. -->
<channel
ref="http"
port="0"
machineName="192.168.1.172">
<clientProviders>
<formatter ref="binary"/>
</clientProviders>
<serverProviders>
<formatter ref="binary" typeFilterLevel="Full"/>
</serverProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>
</configuration>
Jul 21 '05 #1
1 2083
You can extract the hotname and the IP dynamically so you dont need to add
it to config.

http://www.codeproject.com/csharp/Ho...in_Network.asp

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

<ja*****@texeme.com> wrote in message
news:_r********************@speakeasy.net...

I have the config file below.

Is there anyway for the value of MachineName to be populated,
automatically, with the IP address that the application is running on?

So, I would say something like machineName=@IPAddress or some such
thing...


<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.runtime.remoting>
<application>
<client>
<wellknown
type="ChatCenter, ChatCenter"
url="http://192.168.1.59:8080/Chat"
/>
</client>
<channels>
<!-- The "0" port is declared to allow remoting to choose -->
<!-- the most appropriate channel. You must specify a
channel -->
<!-- here, however; if you do not do so, your ChatClient -->
<!-- will not be listening for the call back from the -->
<!-- ChatCoordinator object. -->
<channel
ref="http"
port="0"
machineName="192.168.1.172">
<clientProviders>
<formatter ref="binary"/>
</clientProviders>
<serverProviders>
<formatter ref="binary" typeFilterLevel="Full"/>
</serverProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>
</configuration>

Jul 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Billy Jacobs | last post: by
11 posts views Thread by Paul D.Smith | last post: by
17 posts views Thread by Mike L | last post: by
7 posts views Thread by Greg Collins [MVP] | last post: by
41 posts views Thread by Miguel Dias Moura | last post: by
2 posts views Thread by Brad Pears | last post: by
12 posts views Thread by Chris Allen | last post: by
3 posts views Thread by Connolly | last post: by
reply views Thread by XIAOLAOHU | last post: by

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.