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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:27:50+00:00 2026-06-13T12:27:50+00:00

I am new WCF programming, I did followed series of Getting Started tutorials from

  • 0

I am new WCF programming, I did followed series of Getting Started tutorials from following link

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

I have hosted service in console application but when I tried to create a client and tried to add service reference I got the following exceptions.

There was an error downloading
‘http: localhost:8000/GettingStarted/mex/_vti_bin/ListData.svc/$metadata’.
The request failed with HTTP status 405: Method Not Allowed. Metadata
contains a reference that cannot be resolved:
‘http: localhost:8000/GettingStarted/mex’. There was no endpoint
listening at http: localhost:8000/GettingStarted/mex that could
accept the message. This is often caused by an incorrect address or
SOAP action. See InnerException, if present, for more details. The
remote server returned an error: (404) Not Found. If the service is
defined in the current solution, try building the solution and adding
the service reference again.

code of hosting application

class Program
{
    static void Main(string[] args)
    {
        // Step 1 Create a URI to serve as the base address.
        Uri baseAddress = 
            new Uri("http://localhost:8000/GettingStarted/");

        // Step 2 Create a ServiceHost instance
        ServiceHost selfHost = 
            new ServiceHost(typeof(CalculatorService), baseAddress);

        try
        {
            // Step 3 Add a service endpoint.
            selfHost.AddServiceEndpoint(typeof(ICalculator), 
                new WSHttpBinding(), 
                "CalculatorService");

            // Step 4 Enable metadata exchange.
            var smb = new ServiceMetadataBehavior();
            smb.HttpGetEnabled = true;
            selfHost.Description.Behaviors.Add(smb);

            // Step 5 Start the service.
            selfHost.Open();
            Console.WriteLine("The service is ready.");
            Console.WriteLine("Press <ENTER> to terminate.");
            Console.WriteLine();
            Console.ReadLine();

            // Close the ServiceHostBase to shutdown.
            selfHost.Close();
        }
        catch (CommunicationException ce)
        {
            Console.WriteLine("exception: {0}", ce.Message);
            selfHost.Abort();
        }
    }
}

Now I am unable to figure out what the problem is. I am using visual studio 2012 and .net platform 4.5.

  • 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-06-13T12:27:50+00:00Added an answer on June 13, 2026 at 12:27 pm

    I had a similar issue as well, messing with this. Yes you seem to have followed the tutorial correctly, but if you want to connect to it and consume as a service (as in make a service reference) you must also add in the MEX service enpoint. Add this line after your selfhost.Description.Behaviors.Add(smb):

    selfhost.AddServiceEndpoint(
                typeof(IMetadataExchange),
                MetadataExchangeBindings.CreateMexHttpBinding(),
                "http://localhost:8000/GettingStarted/mex");
    

    That should enable you to connect via “Add Service Reference”. Also, I have found depending on your system, you may need to run VS as admin to allow for connection to network (in case you accidentally told it no in the past).

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

Sidebar

Related Questions

I'm just getting into WCF programming. I've set up a self-hosted test web service
I'm new to WCF and in a large part, also distributed programming. I am
I am new to wcf programming and I have been working on a small
I am new to WCF programming and its syndication classes etc. I am trying
I used this link to learn WCF programming I used the sample code in
I want to create new WCF service and client. The 2 parties will communicate
I want to create a new WCF service and client. The 2 parties will
I'm new to WCF, and googled on that problem, but to no avail. I
I am new to WCF so I think this is pretty basic. I have
I'm new to WCF data services. I have a quite simple data model. Some

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.