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 903463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T15:52:58+00:00 2026-05-15T15:52:58+00:00

I built a project as descripted in this URL: http://msdn.microsoft.com/en-us/library/ms734784.aspx I used the app.config

  • 0

I built a project as descripted in this URL:

http://msdn.microsoft.com/en-us/library/ms734784.aspx

I used the app.config version. But using the code-Version does not change anything (the timeout-error still occurs).

To create the ServiceHost I used the following code:

this.serviceHost = new ServiceHost(typeof(Calculator));
// Open the ServiceHostBase to create listeners and start 
// listening for messages.
this.serviceHost.Open();

On the client side I used the following code:

ChannelFactory<ICalculator> factory = new ChannelFactory<ICalculator>("netTcp_ICalculator");
ICalculator communicationChannel = this.factory.CreateChannel();
string test = communicationChannel.GetData(5);

On the last line the program waits one minute, then I get a timeout:

This request operation sent to net.tcp://localhost:8008/Calculator did not
receive a reply within the configured timeout (00:01:00).
The time allotted to this operation may have been a portion
of a longer timeout. This may be because the service is still
processing the operation or because the service was unable to
send a reply message. Please consider increasing the operation
timeout (by casting the channel/proxy to IContextChannel and
setting the OperationTimeout property) and ensure that the service
is able to connect to the client.

The class Calculator and the interface exist. Besides this timeout I get no other error. I set a breakpoint at the GetData method, but the breakpoint was not hit.

I have tried to change the portnumber used for the client from 8008 to 8009, but let the endpoint for the server at 8008. I wanted to test if the client tries to reach the server. Then I get the error that the other side is not answering (EndpointNotFoundException).

When changing the client port back to 8008 I get the Timeout error again.

Is there anything wrong with my code?
How can I ensure that the server can reach the client?
Client and server are in the same test application.

Thank you for your help!

EDIT:

I have now deleted the app.config settings. And tried to build the server and client by using the sourcecode. To build the server was no problem. But building the client is a problem.

There is no way to call:

CalculatorClient cc = new CalculatorClient(myBinding, myEndpointAddress);

The compiler does not know CalculatorClient.

Can I use the following instead?

NetTcpBinding myBinding = new NetTcpBinding();
myBinding.Security.Mode = SecurityMode.None;

// Create the address string, or get it from configuration.
string tcpUri = "net.tcp://localhost:8008/Calculator";

// Create an endpoint address with the address.
EndpointAddress myEndpointAddress = new EndpointAddress(tcpUri);
ChannelFactory<ICalculator> factory = new ChannelFactory<ICalculator>(myBinding, myEndpointAddress);
factory.Open();
ICalculator communicationChannel = this.factory.CreateChannel();
string test = communicationChannel.GetData(5);

I get again an exception at the last line 🙁

SOLVED:

Ok, the problem is solved. I needed to call the WCF host initialization via an own thread:

hostThread = new Thread(this.createService);
hostThread.Start();

Now everything works fine!

Thanks for all your help!

  • 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-15T15:53:00+00:00Added an answer on May 15, 2026 at 3:53 pm

    You are not adding any endpoints to the service.
    You did not include the part of the example code that adds the service endpoint:

    Uri tcpUri = new Uri("net.tcp://localhost:8008/Calculator");
    // Create the ServiceHost.
    ServiceHost sh = new ServiceHost(typeof(Calculator), tcpUri);
    
    // Create a binding that uses TCP and set the security mode to none.
    NetTcpBinding b = new NetTcpBinding();
    b.Security.Mode = SecurityMode.None;
    
    // Add an endpoint to the service.
    sh.AddServiceEndpoint(typeof(ICalculator), b, "");
    // Open the service and wait for calls.
    sh.Open();
    

    Edit: Same goes for your client. You have to specify an endpoint addresses

      // Create a channel factory.
      NetTcpBinding b = new NetTcpBinding();
      b.Security.Mode = SecurityMode.None;
      Uri tcpUri = new Uri("net.tcp://localhost:8008/Calculator");
    
      ChannelFactory<ICalculator> myChannelFactory = new ChannelFactory<ICalculator>(b,new EndpointAddress(tcpUri));
    
      // Create a channel.
      ICalculator calculator = myChannelFactory.CreateChannel();
    

    Edit2: I can’t currently test this code… Will give it a try tomorrow morning.

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

Sidebar

Related Questions

So I built my project and I have a .app file from my BUILD
I am facing a another problem. I built a project in php. the url
What happened to the Maven Polyglot project that used to be at http://polyglot.sonatype.org/ ?
I followed the PhoneGap getting started guide for iOS (http://phonegap.com/start#ios-x4). Then I used the
I built a project in Eclipse for my BlackBerry. The jar cannot run on
I have a new c++ project built with autoconf, automake and libtool. Functionality is
Does anybody have an experiencing with refactoring a project built with Xcode 4.3 down
I'm currently working on two projects simultaneously: My main project (built with maven) A
I want to export the assemblies built in my project. But where are they
I'd like to use spring support for sending mails. My project is built with

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.