Search code examples
asp.net-web-apiodataasp.net-web-api-odataodata-v4

Suffix ".svc" on url for odata service


This might be a stupid question, I have just a little confusion on the suffix .svc on ODATA service, since most of examples I see always have suffix .svc at root URL, example:

http://services.odata.org/V4/Northwind/Northwind.svc/

Or even on ODATA document example:

enter image description here

When building ODATA on ASP.NET Web Api, I see that the suffix .svc is not actually mandatory, we can add it if we want on routing config.

So what is the purpose to add suffix .svc to the root URL in order to build ODATA service or it's just the convention to specify that this is ODATA service?


Solution

  • The .svc extension was used by WCF Services as the Service-Document and the entry point of the service. Since Web-API uses routing, you do not have (and need) this svc-file. You can however simulate one if you like to, but it is not good practice.

    In fact the .svc ending was one thing that most of the former WCF developers try to hide, because it was not useful and very confusing. It is better to prefix RESTfull service with something like /api/Products(1) or a version api/v1/Products(1)