Quantcast
Channel: Web API
Viewing all articles
Browse latest Browse all 4850

No routing convention was found to select an action for the OData path with template '~/entityset/key/unresolved'.“,”type“:”“”

$
0
0

In my ASP.Net Web API project, I have the following entities- Customer, Warehouse, SKU and Vendors. A customer can have multiple Warehouses, SKUs and Vendors. I have get methods in CustomersController to get the Warehouses by CustomerId or Vendors by Customer Id or SKUs by Customer Id. The following is the code in CustomersController.cs:

[EnableQuery]
 public async Task<IHttpActionResult> GetSKUs([FromODataUri] long key)

[EnableQuery]
public async Task<IHttpActionResult> GetWarehouses([FromODataUri] long key) {}

 [EnableQuery]
 public async Task<IHttpActionResult> GetVendors([FromODataUri] long key) {}

The following URLs works - /BookMyLoad/Customers(10000)/Warehouses and /BookMyLoad/Customers(10000)/SKUs. The following URL gives a 404 error - /BookMyLoad/Customers(10000)/Vendors

Detailed error is: { "error":{ "code":"","message":"No HTTP resource was found that matches the request URI 'http://localhost:62702/BookMyLoad/Customers(10000)/Vendors'.","innererror":{ "message":"No routing convention was found to select an action for the OData path with template '~/entityset/key/unresolved'.","type":"","stacktrace":"" } } }

I have defined both Warehouses and Vendors properly-

    oDataModelBuilder.EntitySet<SKU>("SKUs");
        oDataModelBuilder.EntitySet<Warehouse>("Warehouses");
        oDataModelBuilder.EntitySet<Vendor>("Vendors");           
        oDataModelBuilder.EntitySet<Customer>("Customers");

Can you kindly help me in understanding what am i doing wrong?


Viewing all articles
Browse latest Browse all 4850

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>