-1

I'm trying to create a new project with asp.net. I must connect our web service (made in c#) with my new project. I went to "connect services" -> "right click" -> manage connected services and I went to add WCF web service. There, I ran the project where is located the web service. Then, I added the URL provided to my web browser and I clicked "Go".

The error 400 appear each time as you can see in my screenShot.

enter image description here

And in my new project I have this error:

An error occurred while attempting to find services at 'http://localhost/Services/BlueLifeDataService.svc'. Cannot obtain Metadata from the URI: http://localhost/Services/BlueLifeDataService.svc 
 Check the URI and try again.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.

when I want to connect the web service using my web browser everything works fine. I can call all the query. But not in this situation.

Can you help me please?

dbc
  • 104,963
  • 20
  • 228
  • 340
  • Might you please [edit] your question to your code and exception details as **text** rather than as a screenshot? On stack overflow images should not be used for textual content in questions, see [*Discourage screenshots of code and/or errors*](https://meta.stackoverflow.com/a/307500) and [*Why not upload images of code on SO when asking a question*](https://meta.stackoverflow.com/a/285557) for why. For instructions on formatting see *[How do I format my code blocks?](https://meta.stackexchange.com/q/22186)*. – dbc Dec 14 '21 at 01:25
  • In fact, if you could possibly share a [mcve] showing us exactly how to reproduce the problem, that would be great, and maximize the chance that someone here can help you. See: [ask]. For comparison, see [WCF - Error: Cannot obtain Metadata](https://stackoverflow.com/q/10192824/3744182) for a question that included enough information (specifically the web.config) to attract a correct answer. – dbc Dec 14 '21 at 01:26

1 Answers1

0

Your service web.config needs a metadata endpoint <serviceMetadata/>, maybe you can provide web.config.

<behaviors>
    <serviceBehaviors>
        <behavior>
            <serviceMetadata/>
        </behavior>
    </serviceBehaviors>
</behaviors>

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

Lan Huang
  • 613
  • 2
  • 5