No routing convention was found to select an action for the OData path with template '~/entityset'

asp.net-web-api, asp.net-web-api-routing, c#-4.0, odata, odata4j

Solution

Please change the name of the method which returns entityset to "`Get[EntitySetName]`" or "`Get`".

Change from

public IQueryable<User> GetUser()

To

public IQueryable<User> GetUserOdata()

Or

public IQueryable<User> Get()

Problem

I have two Odata action methods defined. The one with parameter gets invoked while the other without parameter doesnt get invoked and throws error No routing convention was found to select an action for the OData path with template '~/entityset'. Here is the code of my action methods ``` [EnableQuery] public IQueryable<User> GetUser() { return db.Users; } // GET: odata/User(5) [EnableQuery] public SingleResult<User> GetUser([FromODataUri] int key) { return SingleResult.Create(db.Users.Where(user => user.Id == key)); } ``` The query that I am using are as follows ``` http://bureauservice/api/odata/UserOdata - Doesnt work http://bureauservice/api/odata/UserOdata(1) - works ``` Could someone tell me why the first link doesnt work.

Original source