Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can RESTful WCF services be added via "Add Service Reference"?

Long time ago, in a world far far away, we used to be able to add web service references to projects simply by right-clicking on the project's References node, and clicking "Add Service Reference". I used to be able to do this with .asmx services, and traditional WCF service.

When I follow different online instructions on "making my WCF RESTful", do I also lose the ability to "Add Service Reference" to those WCF services? Can WCF based REST services be added this way?

If I use Web API 2, can I "Add Service Reference"?

Assume I'm using the latest of everything - VS2015, etc.

like image 788
Steve Kennedy Avatar asked Dec 02 '15 18:12

Steve Kennedy


People also ask

Is it possible to use RESTful services using WCF?

You can use WCF to build RESTful services in . NET. REST (Representational State Transfer) is an architecture paradigm that conforms to the REST architecture principles. The REST architecture is based on the concept of resources: It uses resources to represent the state and functionality of an application.

Which WCF attribute is used to define RESTful services?

WCF has the option to send the response in JSON object. This can be configured with the WebGet or WebInvoke attribute and the WebHttpBinding. This allows you to expose a ServiceContract as a REST service that can be invoked using either JSON or plain XML.

How do I change my WCF service reference?

Updating the Service Reference on the Client Regenerating your WCF Data Service is the first step. The second step is to update the Service Reference in the client project. You could do that directly in Solution Explorer. Right click the generated service reference and select Update Service Reference.


1 Answers

When I follow different online instructions on "making my WCF RESTful", do I also lose the ability to "Add Service Reference" to those WCF services? Can WCF based REST services be added this way?

Kind of. You can add a REST MEX endpoint, but I don't think you can use that to generate a service proxy. Though, I think a better question might be, why would you want to? Web API is the best way to go for REST.

If I use Web API 2, can I "Add Service Reference"?

No. Web API doesn't have any type of metadata functionality like WCF.

like image 72
Cam Soper Avatar answered Sep 21 '22 07:09

Cam Soper