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

  • Home
  • SEARCH
  • 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 4016382
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:43:59+00:00 2026-05-20T09:43:59+00:00

EDIT: After I modified the web.config and I don’t get error that’s good…. then

  • 0

EDIT:

After I modified the web.config and I don’t get error that’s good…. then I add a new page (html) and write this small code to consume the service like this:

 $("#btn12").click(function (event) {
                $.getJSON('http://localhost:3576/MyService.svc/GetCurrentUser', {},
                function (data) {
                    alert(data);
                });
                //return false;
            });

I see the following error in my FireBug:

http://localhost:3576/MyService.svc/GetCurrentUser
400 Bad Request

Note: I have added html page on the same wcf project and running the project it self so I am assuming the service is also running …

What might be wrong here?

END EDIT

I have just created a new wcf services and when I hit f5 from VS and I get this error in WCF Test Client window :

Failed to add a service. Service metadata may not be accessible. Make sure your service is running and exposing metadata.

Error: Cannot obtain Metadata from http://localhost:3696/MobileService.svc 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:3696/MyService.svc
Metadata contains a reference that cannot be resolved: ‘http://localhost:3696/MyService.svc‘.

There was no endpoint listening at http://localhost:3696/MyService.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

Unable to connect to the remote server
No connection could be made because the target machine actively refused it 127.0.0.1:3696
HTTP GET Error
URI: http://localhost:3696/MyService.svc
There was an error downloading ‘http://localhost:3696/MyService.svc‘.
Unable to connect to the remote server
No connection could be made because the target machine actively refused it 127.0.0.1:3696

My config:

<behaviors>
    <endpointBehaviors>
        <behavior name="MyService.MyService">
            <webHttp/>
        </behavior>
    </endpointBehaviors>
    <serviceBehaviors>
        <behavior name="metadataBehavior">
            <serviceMetadata httpGetEnabled="true" httpGetUrl="http://localhost:2812/MyService.svc" />
        </behavior>
    </serviceBehaviors>
</behaviors>
<services>
    <service name="MyService.MyService" 
             behaviorConfiguration="metadataBehavior">
        <endpoint 
            address="http://localhost/MyService.svc" 
            binding="customBinding"
            bindingConfiguration="jsonpBinding" 
            behaviorConfiguration="MyService.MyService"
            contract="MyService.IMyService"/>
    </service>
</services>
<bindings>
    <customBinding>
        <binding name="jsonpBinding">
            <jsonpMessageEncoding/>
            <httpTransport manualAddressing="true"/>
        </binding>
    </customBinding>
</bindings>
<extensions>
    <bindingElementExtensions>
        <add name="jsonpMessageEncoding" type="Microsoft.Ajax.Samples.JsonpBindingExtension, MyService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/>
    </bindingElementExtensions>
</extensions>
  • 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-20T09:44:00+00:00Added an answer on May 20, 2026 at 9:44 am

    You need to add a metadata exchange (mex) endpoint to your service:

    <services>
       <service name="MyService.MyService" behaviorConfiguration="metadataBehavior">
          <endpoint 
              address="http://localhost/MyService.svc" 
              binding="customBinding" bindingConfiguration="jsonpBinding" 
              behaviorConfiguration="MyService.MyService"
              contract="MyService.IMyService"/>
          <endpoint 
              address="mex" 
              binding="mexHttpBinding" 
              contract="IMetadataExchange"/>
       </service>
    </services>
    

    Now, you should be able to get metadata for your service

    Update: ok, so you’re just launching this from Visual Studio – in that case, it will be hosted in Cassini, the built-in web server. That beast however only supports HTTP – you’re not using that protocol in your binding…

    Also, since you’re hosting this in Cassini, the address of your service will be dictated by Cassini – you don’t get to define anything.

    So my suggestion would be:

    • try to use http binding (just now for testing)
    • get this to work
    • once you know it works, change it to your custom binding and host it in IIS

    So I would change the config to:

    <behaviors>
       <serviceBehaviors>
          <behavior name="metadataBehavior">
             <serviceMetadata httpGetEnabled="true" />
          </behavior>
       </serviceBehaviors>
    </behaviors>
    <services>
       <service name="MyService.MyService" behaviorConfiguration="metadataBehavior">
          <endpoint 
              address=""   <!-- don't put anything here - Cassini will determine address -->
              binding="basicHttpBinding" 
              contract="MyService.IMyService"/>
          <endpoint 
              address="mex" 
              binding="mexHttpBinding" 
              contract="IMetadataExchange"/>
       </service>
    </services>
    

    Once you have that, try to do a View in Browser on your SVC file in your Visual Studio solution – if that doesn’t work, you still have a major problem of some sort.

    If it works – now you can press F5 in VS and your service should come up, and using the WCF Test Client app, you should be able to get your service metadata from a) the address that Cassini started your service on, or b) the mex address (Cassini’s address + /mex)

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

Sidebar

Related Questions

FINAL EDIT: After following the answer from Darin Dimitrov, I have found that the
EDIT 1 I apologize but after reading the 2 suggested articles I still don't
EDIT: My mistake was that I had a go after the first select statement
I have a web setup project that creates an MSI. After first installation, my
Recently I came across the error Collection was modified after the enumerator was instantiated
EDIT: After Joel Coehoorns excellent answer, I understand that I need to be more
Edit note: After a seemingly enourmous amount of bad feedback MS got from their
I'm trying to immediately set a row to Edit mode after it is created.
Possible Duplicate: Saving changes after table edit in SQL Server Management Studio I need
oo design basics here... Edit: To clarify after first answer - I'm not asking

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.