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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:21:57+00:00 2026-06-14T11:21:57+00:00

i am learning wcf. so i create wcf project and that has one class.

  • 0

i am learning wcf. so i create wcf project and that has one class. code as follows

namespace TestWcfService1
{
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and config file together.
public class Service1 : IService1
{
    public string GetData(string value)
    {
        return string.Format("You entered: {0}", "Welcome " + value);
    }

}
}

now when i am trying to add the wcf service reference to my console apps like add service reference and the service url like this http://localhost:21541/Service1.svc then i am getting error called Metadata contains a reference that cannot be resolved: ‘http://localhost:21541/Service1.svc’.

so i am just not being able to achieve my goal. i know some where i am missing something and that is why i am getting error. so please guide me how to add service ref to console apps. app.config will be updated automatically or do i need to write anything there. help please. thanks

  • 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-14T11:21:59+00:00Added an answer on June 14, 2026 at 11:21 am

    In the configuration double check that the service behavior is set up to allow service metadata:

    <serviceMetadata httpGetEnabled="true"/>

    and in the services section add a metadata endpoint

    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>

    EDIT: Example config

    <system.serviceModel>
      <services>
        <service behaviorConfiguration="BehaviorConfig"
          name="[ServiceNameGoesHere]">
          <endpoint address="" binding="wsHttpBinding" contract="[ServiceContractHere]">
          </endpoint>
          <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        </service>
      </services>
      <behaviors>
        <serviceBehaviors>
          <behavior name="BehaviorConfig">
            <serviceMetadata httpGetEnabled="True"/>
            <!-- To receive exception details in faults for debugging purposes, 
            set the value below to true.  Set to false before deployment 
            to avoid disclosing exception information -->
            <serviceDebug includeExceptionDetailInFaults="False" />
          </behavior>
        </serviceBehaviors>
      </behaviors>
    </system.serviceModel>
    

    There is a pretty good writeup on Dan Rigsby’s blog called WCF Metadata which explains in greater details about setting up the MEX endpoints (which are required for Add Service Reference to work).

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

Sidebar

Related Questions

I am learning WCF,one of the benefits of WCF is that you can use
I'm just learning wcf and can't understand one very basic thing. I'm creating a
I've just started learning WCF. It seems that every single use of the (remote)
I am learning to create RESTful services using WCF. There are a myriad of
I'm currently learning wcf for an up and coming project. The service I am
In Learning WCF , by Michele Bustamante, there is a section that describes a
I just started learning on WCF and is trying to create a WCF service
I am learning WCF and right now I am getting one exception while running
As I'm currently learning to use WCF Services, I am constantly encountering tutorials on
I am learning and designing a WCF service. I have picked to use Windows

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.