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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:02:02+00:00 2026-05-25T01:02:02+00:00

I am trying to test my self hosted wcf service using WCFTestClient. I get

  • 0

I am trying to test my self hosted wcf service using WCFTestClient. I get an error like so:

Error: Cannot obtain Metadata from http://localhost:2303/MyService If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata Exchange Error URI: http://localhost:2303/MyService Metadata contains a reference that cannot be resolved: ‘http://localhost:2303/MyService’. Content Type application/soap+xml; charset=utf-8 was not supported by service http://localhost:2303/MyService. The client and service bindings may be mismatched. The remote server returned an error: (415) Cannot process the message because the content type ‘application/soap+xml; charset=utf-8’ was not the expected type ‘text/xml; charset=utf-8’..HTTP GET Error URI: http://localhost:2303/MyService There was an error downloading ‘http://localhost:2303/MyService’. The request failed with HTTP status 400: Bad Request.

My project structure is as follows

  1. Console Application that acts as host
  2. Service Contract
  3. Service implementation

Here are my service implementation and Contract classes, which are in two separate projects.

namespace MyService
{
    public class MyService : IMyService
    {
        public string GetGreeting(string name)
        {
            return "Hello " + name;
        }

        public string GetYelling(string name)
        {
            return "What the hell " + name + "!!";
        }
    }
}

namespace MyService
{
    [ServiceContract]
    public interface IMyService
    {
        [OperationContract]
        string GetGreeting(string name);

        [OperationContract]
        string GetYelling(string name);
    }
}

This is the console app

namespace MyWCFHost
{
    class Program
    {
        static void Main(string[] args)
        {

            ServiceHost serviceHost = new ServiceHost(typeof(MyService.MyService), new Uri("http://localhost:2303"));
            serviceHost.Open();

            Console.WriteLine("MyService is running...");
            Console.ReadKey();
            serviceHost.Close();
        }
    }
}

This is the config file

<configuration>

  <system.serviceModel>
    <services>
      <service name ="MyService.MyService" behaviorConfiguration="MyService.MyServiceBehavior">
        <endpoint address="http://localhost:2303/MyService" binding="basicHttpBinding" contract="MyService.IMyService"/>
        <endpoint address="mex" binding="mexHttpBinding" name="mexpoint" contract="IMetadataExchange" />
      </service>

    </services>

    <behaviors>
      <serviceBehaviors>
        <behavior name="MyService.MyServiceBehavior">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>

  </system.serviceModel>


</configuration>

What am I doing wrong?

Thanks for your time…

Edit

The service works when I try to run it via a winforms client so I know the service is working. Question is how do I get it ready for testing as well, using WcfTestClient.

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

    I suspect you have a problem with your MEX endpoint. You’re currently only specifying a relative address (“mex”) – but there’s no base address for HTTP defined in your service ……

    I would suggest to:

    • either define a base address and then use only relative addresses “on top” of that – for your regular and your MEX endpoint

    OR:

    • define your addresses as full, complete addresses – not just for your regular endpoints, but in that case for the MEX endpoint as well.

    So change your config to be something like:

    <service name ="MyService.MyService" behaviorConfiguration="MyService.MyServiceBehavior">
        <endpoint 
            address="http://localhost:2303/MyService" 
            binding="basicHttpBinding" 
            contract="MyService.IMyService"/>
        <endpoint name="mexpoint" 
            address="http://localhost:2303/MyService/mex" 
            binding="mexHttpBinding" 
            contract="IMetadataExchange" />
      </service>
    

    and then I hope you should be able to get at your metadata and thus connect to your service!

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

Sidebar

Related Questions

I'm trying to call an wcf self hosted method from jquery but, i'm aways
There is a self hosted WCF REST service, need to send an xml post
I'm trying to test cherrypy framework by using example from their site: import cherrypy
I'm trying to test a secure http connection using self signed certificates... just for
Im trying to test my successfully creates a new user after login (using authlogic).
I am trying to test that a particular method throws an expected exception from
I am trying to test for an exception. I have: def test_set_catch_status_exception(self): mro =
I'm trying to run this test: self.assertRaises(AttributeError, branch[0].childrennodes) , and branch[0 ] does not
I have an AJAX Enabled REST Web Service self hosted at http://localhost/machinename/ and a
The method I am trying to test is: def self.load_file(file) lookup = '' if

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.