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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:18:31+00:00 2026-05-31T19:18:31+00:00

I created a basic calculator service called MiniCalc that only has two operations. Add

  • 0

I created a basic calculator service called MiniCalc that only has two operations. Add and Mul, and hosted it in a Console Application.

using(ServiceHost host = new ServiceHost(typeof(MiniCalcService.Service),
                                         new Uri("http://localhost:8091/MiniCalcService")))
{
    host.AddServiceEndpoint(typeof(MiniCalcService.IService),
                            new BasicHttpBinding(),
                            "Service");
    host.Open();
    Console.Write("Press ENTER key to terminate the MiniCalcHost . . . ");
}

Then I created a console application to consume the service and created the proxy manually by creating a proxy class and then created a ChannelFactory to invoke the service.

EndpointAddress ep = new EndpointAddress("http://localhost:8091/MiniCalcService/Service");
IService proxy = ChannelFactory<IService>.CreateChannel(new BasicHttpBinding(),ep);

I was able to invoke the service contract properly and retrieve the result as expected.

Now I wanted to create the proxy using the Add Service Reference.

I get the following error when I click Go in the Add Service Reference window

There was an error downloading 'http://localhost:8091/MiniCalcService/Service'.
The request failed with HTTP status 400: Bad Request.
Metadata contains a reference that cannot be resolved: 'http://localhost:8091/MiniCalcService/Service'.
Content Type application/soap+xml; charset=utf-8 was not supported by service http://localhost:8091/MiniCalcService/Service.  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'..
If the service is defined in the current solution, try building the solution and adding the service reference again.

What am I missing or doing wrong?

  • 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-31T19:18:32+00:00Added an answer on May 31, 2026 at 7:18 pm

    Enable Metadata exchange behavior in your ServiceHost.

    using(ServiceHost host = new ServiceHost(typeof(MiniCalcService.Service),
                                 new Uri("http://localhost:8091/MiniCalcService")))
    {
        host.AddServiceEndpoint(typeof(MiniCalcService.IService),
                                new BasicHttpBinding(),
                                "Service");
    
        //Enable metadata exchange
        ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
        smb.HttpGetEnabled = true;
        host.Description.Behaviors.Add(smb);
    
        host.Open();
        Console.Write("Press ENTER key to terminate the MiniCalcHost . . . ");
    }
    

    http://wcftutorial.net/WCF-Self-Hosting.aspx

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

Sidebar

Related Questions

I created a calculator class that does basic +,-, %, * and sin, cos,
I'm trying to develop a basic GPA Calculator. I have an AllCourses class that
I've created a database with a table (customer table) that holds basic customer information
I have a very basic Visual Basic Program that I created in Visual Studio
I have a Rails 3.2.2 application using Ruby version 1.9.2. I have created basic
I have created a basic site using ASP.NET routing according to Mike Ormond's example
I've created this basic 3D Demo using OpenGL/SDL. I handled the keyboard callback so
I created a site template from a basic site which was itself created from
We have created a simple wix project for a basic windows application. Everything builds
I have basic hello word example of Prime Faces. I have created dynamic web

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.