WCF Error : Cannot obtain Metadata from WCF service

SUMAN7910 20 Reputation points
2023-02-07T14:43:03.54+00:00

Hello All,

We have a webservice in asp.net wcf (ex.. http://localhost:56561/ProductOData.svc/). We are able to add as a service reference in asp.net mvc. However, we are trying to add the same service in asp.net core 6.0 and it is not working. The error below. Through browser, we are able to see the metadata with this URL: http://localhost:56561/ProductOData.svc/$metadata

An error occurred while attempting to find services at 'http://localhost:56561/ProductOData.svc/'. Cannot obtain Metadata from the URI: http://localhost:56561/ProductOData.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.

Can some one please help on this?

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,337 questions
0 comments No comments
{count} votes

Accepted answer
  1. Michael Taylor 47,626 Reputation points
    2023-02-07T15:53:09.4333333+00:00

    Please provide us more information. You said you aren't able to add the same service in ASP.NET 6.0. How are you adding it? Are you using a Connected Service? Are you using the svcutil tool to generate the proxy? Are you trying to reuse code written for .NET 4.x to talk to .NET 6? Providing any relevant code would help here.

    Note that WCF service metadata is generally exposed as {svcurl}?wsdl assuming you have enabled MEX and haven't changed the URL. Also note that you need to use either http or https depending on how the service is configured to return metadata.


0 additional answers

Sort by: Most helpful