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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T20:38:42+00:00 2026-05-16T20:38:42+00:00

Using Visual Studio 2010, I have written a simple WCF service and some integration

  • 0

Using Visual Studio 2010, I have written a simple WCF service and some integration tests that I want to run against it. I build my proxy for the tests at runtime in code rather than using configuration.

My tests pass in debug but not when run!

FAIL if run – go Test/Run/Tests in current context ( as the WCF Service it calls has not been hosted)

PASS in debug – go Test/Debug/Tests in current context ( as the WCF project has WCF Options/Start WCF Service Host when debugging another project in the same solution)

Is there a way to get WCFServiceHost to start when the tests are run normally?

Thanks,
Andy

Test method BulkLoaderIntegrationTests.IntegrationTests.ImportEntries_withGoodPCMs_reportsCreatedOk threw exception: 
    System.ServiceModel.EndpointNotFoundException: Could not connect to net.tcp://localhost:8001/OLELoader. The connection attempt lasted for a time span of 00:00:00.9687686. TCP error code 10061: No connection could be made because the target machine actively refused it 127.0.0.1:8001.  ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:8001
  • 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-16T20:38:43+00:00Added an answer on May 16, 2026 at 8:38 pm

    I disabled ‘Start WCF Service Host’ when debugging another project in the same solution.

    I added a static method in [ClassInitialize] to ‘self host’ the WCF service within the Test context for the duration of the testing.

            [ClassInitialize]
            public static void Init(TestContext t)
            {
                IntegrationTests.InitService();
            }
    
            [ClassCleanup]
            public static void CleanUp()
            {
                IntegrationTests.host.Close();         
            }
    
            private static bool ServiceIsStarted = false;
            private static ServiceHost host;
            private static void InitService()
            {           
                if (!ServiceIsStarted)
                {
                    // Create the ServiceHost.
                    host = new ServiceHost(typeof (OLEImport),
                                               new Uri(IntegrationTestHelper.BaseAddress));
    
                    // Enable metadata publishing.
                    ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
                    smb.MetadataExporter.PolicyVersion = PolicyVersion.Policy15;
                    host.Description.Behaviors.Add(smb);
    
                    host.Open();
                    ServiceIsStarted = true;
                }
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WCF-Service, written in Visual Basic using Visual Studio 2010. I would
I have a Windows service written in C# using Visual Studio 2010 and targeting
We have developers using Visual Studio 2010 professional and some trying out Visual Studio
I am using Visual Studio 2010, Windows 7 and IIS. I have written a
I have written a program in C# using Visual Studio 2010. At current it
I have written a small application in C# using Visual Studio 2010. It is
Ok so I have an assembly, written in C#, using Visual Studio 2010. This
I have a stackoverflow problem with a C# application written using Visual Studio 2010
I have a console application written using Visual Studio 2010 / C#. I added
We have an application that was built using Visual Studio 2010 targeting the .NET

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.