No non-OData HTTP route registered : <p>I followed <a href="https://docs.microsoft.com/en-US/azure/app-service-web/web-sites-dotnet-rest-service-aspnet-api-sql-database" rel="noreferrer">this</a> tutorial to create a WebAPI REST service.</p>

<p>After that, I could load the list of all contacts by pointing at <code>http://baseaddress/api/Contacts</code>.</p>

<p>Then I added the following code in the <code>Register</code> method in WebApiConfig.cs in order to enable an OData endpoint:</p>

<pre><code>config.Count().Filter().OrderBy().Expand().Select().MaxTop(null);

ODataModelBuilder builder = new ODataConventionModelBuilder();
builder.EntitySet&lt;Contact&gt;("Contacts");
config.MapODataServiceRoute(
    routeName: "OData",
    routePrefix: "odata",
    model: builder.GetEdmModel());
</code></pre>

<p>And also added the <code>[EnableQuery]</code> parameter on the <code>Contact.GetContacts()</code> method. That way, I am able to query for particular contacts like this:</p>

<pre><code>http://baseaddress/odata/Contacts?$filter=startswith(Name,'A')
</code></pre>

<p>and it works like charm.</p>

<p>Unfortunately, when I put the <code>[EnableQuery]</code>, the WebAPI endpoint stops working, showing instead the following error:</p>

<pre><code>No non-OData HTTP route registered.

in System.Web.OData.Extensions.HttpConfigurationExtensions.GetNonODataRootContainer(HttpConfiguration configuration)
in System.Web.OData.Extensions.HttpRequestMessageExtensions.GetRootContainer(HttpRequestMessage request, String routeName)
in System.Web.OData.Extensions.HttpRequestMessageExtensions.CreateRequestScope(HttpRequestMessage request, String routeName)
in System.Web.OData.Extensions.HttpRequestMessageExtensions.CreateRequestContainer(HttpRequestMessage request, String routeName)
...
</code></pre>

<p>What should I do to fix this?</p>
