i created Odata service in side of the web api. i put a break point on GetFavoriteStation. but it is not working. mydomain:127.0.0.1
i called this URL : mydomain/odata/2013-06/X(guid’23C868DC-07FE-4AC4-B399-D4E76EDE9F0C’) but it is not working. it returns to me error. ERROR: The resource cannot be found.
[AllowAnonymous]
public class XController : EntitySetController<X, Guid>
{
[Queryable]
public X GetX([FromODataUri]Guid id)
{
X x= null;
Look App_Start files
WebApiConfig.cs
namespace Y.Z
{
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/2013-06/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
}
I found that these are suspicious:
If it is an odata service there is no need to do this:
config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/2013-06/{controller}/{id}", defaults: new { id = RouteParameter.Optional } );