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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T01:43:38+00:00 2026-05-13T01:43:38+00:00

I am in the process of writing some test for a server that is

  • 0

I am in the process of writing some test for a server that is implemented in WCF, as the messages are complex and call-backs are made to the clients I wish to include WCF in the tests.

(You may wish to call these “fit” or “integration tests” not unit tests, the code on both side of WCF will have more detail unit test that don’t use WCF.)

As my server keeps state and I wish to check that all channels shut down without errors, I have code like:

    [SetUp]
    public void SetUp()
    {
        //TODO find a fee port rathern then hard coding
        endPointAddress = "net.tcp://localhost:1234";

        mockEngineManagerImp = new Mock<IEngineManagerImp>();              

        EngineManager engineManager = new EngineManager(mockEngineManagerImp.Object);

        serviceHost = new ServiceHost(engineManager);
        serviceHost.AddServiceEndpoint(
            typeof(IEngineManager), 
            new NetTcpBinding(SecurityMode.None),
            endPointAddress);

        serviceHost.Open();      
    }

    [TearDown]
    public void TearDown()
    {
        serviceHost.Close();
    }

However my tests are very slow….

How can I speed up the creation and destroying of my ServiceHost?

  • 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-13T01:43:38+00:00Added an answer on May 13, 2026 at 1:43 am

    Thanks for all the great answers – they all contains helpful pointers,

    I found that a lot of my tests were not closing the client chancel, this make the close on the server channel wait until the TCP connection from the client had timed out.

    Sorting this out led to over a factor of 10 speed up.

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

Sidebar

Related Questions

I am writing a program that creates a process and then read some bits
I have been writing some a django project / app that initiates some test
I am in the process of writing some validation code based on these assumptions:
We are currently going through the long process of writing some coding standards for
Let's say you had an external process writing files to some directory, and you
I am trying to fully understand the process pro writing code in some language
I'm in the process of writing a jQuery plugin, and am getting into some
I would like seek some guidance in writing a process profiler which runs in
I'm in the process of writing a small text-editor that is supposed to have
I am in the process of writing a small WordPress data sync plugin that

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.