简体   繁体   中英

ASP.NET WebApi Odata error 404

I am new to OData.

Thus, I'm following this tutorial very closely. ( http://www.asp.net/web-api/overview/odata-support-in-aspnet-web-api/getting-started-with-odata-in-web-api/create-a-read-only-odata-endpoint )

However, in the 2nd part of the tutorial ( http://www.asp.net/web-api/overview/odata-support-in-aspnet-web-api/getting-started-with-odata-in-web-api/explore-the-odata-endpoint ), when I try to browse http://localhost:52868/odata/products.svc in fiddler, or in browser, I get a 404 error.

The OData package I installed is this http://www.nuget.org/packages/microsoft.aspnet.webapi.odata

The package was just released on the 18th, I'm not sure if anything has changed since the tutorial was posted almost a month ago

The tutorial is a bit off here. If you defined your route like this:

config.Routes.MapODataRoute("ODataRoute", "odata", model);

Then you need to browse to:

http://localhost:52868/odata

to view the service document. Similarly, you can go to:

http://localhost:52868/odata/$metadata

to view the metadata document, and

http://localhost:52868/odata/Products

to get the Products entity set in OData.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM