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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T14:45:09+00:00 2026-05-16T14:45:09+00:00

I have a WCF service with a simple Gallio unit test that calls the

  • 0

I have a WCF service with a simple Gallio unit test that calls the service. However, I am confused by the framework’s behavior. When I start visual studio for the first time, and try to run the unit test, I get the following error:

System.ServiceModel.EndpointNotFoundException: There was no endpoint listening at http://localhost:43671/MyService.svc/MyService that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. —> System.Net.WebException: Unable to connect to the remote server —> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:43671
ErrorCode: 10061

However, if I right click on the Service Reference in the unit test project and do “Update service reference”, a popup saying that ASP.NET Development server on port 43671 has been started shows up, and the unit test works fine.

How do I add the server start up code to my unit test so I don’t have to “Update service reference” every time I want to run a unit test?

Thanks.

  • 1 1 Answer
  • 1 View
  • 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-16T14:45:10+00:00Added an answer on May 16, 2026 at 2:45 pm

    This happens because your WCF service host is not started when you run visual studio. Once you try to update the service reference Visual Studio automatically starts the WCF service host and after that your services will be accessible.

    One way to solve this problem is to host your service(s) in IIS. This will ensure that the services will be accessible even if VS is not running.

    Other solution would be to add reference (assembly reference) to your service and instantiate the service class directly. You don’t need to have the service running to run unit tests against it. So if you have a service class called SomeServiceClass you could create an instance of this class in your unit tests (SomeServiceClass instance = new SomeServiceClass()) and write your asserts against it (without even hosting the service).

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

Sidebar

Related Questions

We have a simple WCF service that is tagged with InstanceContextMode = Single and
I have written a simple WCF service that accepts and stores messages. It works
I have written a very simple WCF service, that worked fine (code below), then
i have a simple xml file in a wcf service that i am trying
I have a simple WCF service that I call server side from code behind
I have a simple WCF service that is used for cross app-domain communication in
I have a simple WCF service that i'm communicating with Asynchronously. The thing i
I have a simple WCF service that will analyse a raw text extracted from
Hello I have a simple wcf service like this, with a test method which
I have a simple WCF service that carries out a simple operation: [OperationContract] DoSomething

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.