Initially when I built an application, there was only a requirement to expose an endpoint using WCF. Now, there is a requirement to expose another endpoint using REST therefore I have used .Net Web Api to do so. The WCF endpoint is hosted in a Windows service therefore I have hosted the Web Api endpoint in the same service. Are there any issues in doing so? Any performance considerations? After some exhaustive searching, I couldn't find any substancial information on the topic.
1 Answers
Are there any issues in doing so?
It may be better to expose the rest API via WCF using webHttpBinding rather than introduce WebAPI into the mix. I'm not aware of any problems this would cause per se, but in terms of solution simplicity I think it makes more sense to take advantage of WCF's multiple-endpoints-to-one-service-contract mapping capability.
I did consider this but I've read a lot of bad reviews about using WCF to expose RESTful endpoints. Moreover, it appears Web Api is the preferred technology as mentioned here: WCF vs ASP.NET Web API
Agreed. If you were starting from scratch then I wouldn't hesitate recommending WebAPI over WCF (actually I would recommend using Nancyfx over WebApi any day of the week).
You can expose your service as HTTP with about 10 minutes work using WCF, assuming you wish to expose the same operations as are currently defined on your service contract, as you have already have the soap endpoint.
Plus you will end up with a simpler solution without the considerable bloat of asp.net/owin.

- 1
- 1

- 30,562
- 14
- 91
- 126
-
I did consider this but I've read a lot of bad reviews about using WCF to expose RESTful endpoints. Moreover, it appears Web Api is the preferred technology as mentioned here: http://stackoverflow.com/questions/9348639/wcf-vs-asp-net-web-api – dhughes Jun 13 '16 at 23:47
-
Thanks for the great info Tom. I'll take a look at Nancyfx too. – dhughes Jun 14 '16 at 10:53