Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6595579
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:57:29+00:00 2026-05-25T17:57:29+00:00

In our server, we configure the port in app.config as follows: <configuration> <system.runtime.remoting> <application>

  • 0

In our server, we configure the port in app.config as follows:

<configuration>
   <system.runtime.remoting>
      <application>
         <channels>
            <channel ref="tcp" port="1234" />
         </channels>
      </application>
   </system.runtime.remoting>
</configuration>

We then proceed to configure the server with the following C# code:

RemotingConfiguration.Configure(string.Format("{0}{1}", appFolder, "app.exe.config"), false);

How do I reference the port number after it has been configured short of parsing the file by hand?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T17:57:29+00:00Added an answer on May 25, 2026 at 5:57 pm

    Looks like it is possible after all. After calling RemotingConfiguration.Configure(string, bool), I run the following method:

    private string GetPortAsString()
              {
                 // Parsing
                 System.Runtime.Remoting.Channels.IChannel[] channels = System.Runtime.Remoting.Channels.ChannelServices.RegisteredChannels;
                 foreach (System.Runtime.Remoting.Channels.IChannel c in channels)
                 {
                    System.Runtime.Remoting.Channels.Tcp.TcpChannel tcp = c as System.Runtime.Remoting.Channels.Tcp.TcpChannel;
                    if (tcp != null)
                    {
                       System.Runtime.Remoting.Channels.ChannelDataStore store = tcp.ChannelData as System.Runtime.Remoting.Channels.ChannelDataStore;
                       if (store != null)
                       {
                          foreach (string s in store.ChannelUris)
                          {
                             Uri uri = new Uri(s);
                             return uri.Port.ToString(); // There should only be one, and regardless the port should be the same even if there are others in this list.
                          }
                       }
                    }
                 }
    
                 return string.Empty;
              }
    

    This gives me the TcpChannel info I need, which allows me to grab the ChannelUri and get the port.

    GRAIT SUCCESS!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Our server application is listening on a port, and after a period of time
we have authetication as file system in our application server. Now i am trying
I am able to configure our Build Server (Team Build 2008) to build our
I am trying to configure our in house development code as a symbol server,
I'm trying to configure Capistrano so that it works for our server setup. We
I've manually installed the latest Eclipse on our debian server and wanted to configure
We're trying to configure our first server and we would like to have maven3
I would like to configure our Mercurial server installation so the rss/atom feed will
I'm trying to configure Tomcat to connect to an LDAP server on our network,
Our server already has symantic anti-virus with autoprotect enabled w/ regular scans and updates.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.