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

  • Home
  • SEARCH
  • 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 3975422
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T04:41:00+00:00 2026-05-20T04:41:00+00:00

I have a WCF self-hosted service in a Windows Forms application. I am going

  • 0

I have a WCF self-hosted service in a Windows Forms application. I am going to be using it so a hand-held mobile device can interact with the application at a basic level.

I have enabled basicHttp (http://localhost:8080/tagservice/basic), NetTCP (net.tcp://localhost:8888/tagservice), and basicHttpMex as endpoints.

For testing purposes, I have setup a virtual machine on the network (and repeated these on a physical machine as well).

These endpoints all work on the local machine where the service is hosted.

However when running the WCFTestClient on remote machines I get mixed results.

  1. Using the above endpoints, I can connect to the service and see the service contracts, proving the mex (IMetadataExhange) works. But I cannot use either http or net.tcp. I get the error message

Could not connect to http://localhost:8080/tagservice/basic. TCP error code 10061: No connection could be made because the target machine actively refused it 127.0.0.1:8080.

Could not connect to net.tcp://localhost:8888/tagservice. The connection attempt lasted for a time span of 00:00:01.0014400. TCP error code 10061: No connection could be made because the target machine actively refused it 127.0.0.1:8888.

  1. When changing localhost to the real IP address in the app.config on the host, in this case 192.168.0.61. Basic HTTP works. However net.icp fails with

    “The server has rejected the client credentials.”

My two questions are:

  1. Why is the net.tcp failing? I am not given a choice to enter credentials as far as I can tell.
  2. Given the IP address can change, how can I get the app.config to use the IP address it is assigned by the DHCP server? As once this software moves from development to production environment the IP address cannot be hardcoded as it will change.
  • 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-20T04:41:01+00:00Added an answer on May 20, 2026 at 4:41 am

    Build and configure the client binding at runtime, so you can programmatically set the URL based on the machine information

    Something like this should work

    string hostName = System.Net.Dns.GetHostName();
    int port = 8080;
    Uri serviceUri = new Uri(string.Format("http://{0}:{1}", hostName, port.ToString()));
    
    
    EndpointAddress endpoint = new EndpointAddress(serviceUri);
    

    Then you just attach that endpoint to your client and it should all hook up.

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

Sidebar

Related Questions

I have a self-hosted WCF service running as a windows service using the WebAPI
We have WCF services being self-hosted by a Windows Service inside our domain, using
I have a self-hosted WCF service with the InstanceContextMode set to PerSession. How can
I have a self hosted WCF Rest service that I am using to simulate
System Description: I have a WCF service (self hosted in a windows service) which
I have a self-hosted WCF service that is hosted by a desktop application. I
I have a self-hosted WCF (as a Windows service), it has a web.config file.
I have a self-hosted WCF web service running, and an Android client application. I
I have an wcf winforms self-hosted app using nettcpbinding.(net.tcp://aaa.homeip.net:9388) The problem is windows 7
I have a single instance WCF service class that is self hosted using a

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.