erotavlas
erotavlas

Reputation: 4475

Unable to add service reference to OData endpoint

I just finished this walkthrough to create an OData V3 endpoint

https://learn.microsoft.com/en-us/aspnet/web-api/overview/odata-support-in-aspnet-web-api/odata-v3/creating-an-odata-endpoint

I got the api working correctly and tested it using PostMan. Now I wanted to consume the endpoint from a .NET client (console application) so I jumped to their other walkthrough

https://learn.microsoft.com/en-us/aspnet/web-api/overview/odata-support-in-aspnet-web-api/odata-v3/calling-an-odata-service-from-a-net-client

However when I try to add a Service Reference, it cannot find any service at the URL I entered (http://localhost/WebAPI_OData/odata/),

The specified OData API cannot be added because OData APIs are now only supported with the OData Client Code Generation Tool.

When I went to the site for the code generation tool it says

OData Client Code Generator support generating client proxy file for OData V4 Service ... It supports following Visual Studio: Visual Studio 2010, 2012, 2013, 2015

Below that it says

OData Connected Service lets app developers connect their applications to OData Services (both V3 & V4) and generate the client proxy files for the services. It supports following Visual Studio:

Visual Studio 2015

But I'm using Visual Studio 2019. So I'm really confused by this. Which tool are we supposed to use for OData V3, and latest Visual Studio? What is the equivalent procedure for adding service reference as indicated by the initial tutorials.

Upvotes: 4

Views: 7386

Answers (1)

GWigWam
GWigWam

Reputation: 2124

In VS2017 one could use the OData v4 Client Code Generator and later Microsoft added the OData Connected Service to the marketplace, see this question for more information.

It appears that the OData connected service is currently not supported in Visual Studio 2019, a Github issue is tracked here. Someone in the comments suggests using the unofficial 'unchase' OData service instead, see: here.

Upvotes: 5

Related Questions