PC Review


Reply
Thread Tools Rating: Thread Rating: 1 votes, 1.00 average.

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

 
 
jabailo@texeme.com
Guest
Posts: n/a
 
      24th Jun 2005

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>
 
Reply With Quote
 
 
 
 
John Timney \(ASP.NET MVP\)
Guest
Posts: n/a
 
      24th Jun 2005
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

<(E-Mail Removed)> wrote in message
news:_rqdnSmlgLyBziHfRVn-(E-Mail Removed)...
>
> 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>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
sharedListeners config in app.config file doesn't recognize customlocation attribute RJ Microsoft Dot NET 0 1st Nov 2006 08:48 PM
using ReadXml to read exe.config file into Grid and update the exe.config using WriteXml hazz Microsoft C# .NET 0 7th Jul 2006 10:32 PM
How to use a variable in web.config ad Microsoft ASP .NET 1 12th Aug 2004 01:29 PM
How to use a variable in web.config ad Microsoft ASP .NET 2 11th Aug 2004 09:01 AM
Re: Using Variable name in Web.Config file Kevin Spencer Microsoft ASP .NET 0 29th Mar 2004 06:52 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:50 PM.