1

I'm getting this error: ODataUnrecognizedPathException: Resource not found for the segment 'sample'.

Controller Code is like this:

[Produces("application/json")]
    [Route("api/Sample")]
    public class SampleController : Controller
    {

        private readonly ISampleBusiness business;
        public SampleController(ISampleBusiness _business)
        {
            business = _business;
        }
        // GET: api/Sample
        [HttpGet]
        [EnableQuery]
        public async Task<IQueryable<ISGUserDTO>> Get()
        {
            var data = await business.GetAll();
            return data.Data;
        }

and

Startup Code like this:

public void ConfigureServices(IServiceCollection services)
        {
services.AddOData<ISampleBusiness>(builder => builder.EntitySet<Business.Contracts.DTO.Infra.ISGUserDTO>("Sample"));

Configure like this:

public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
app.UseOData("api");

Any ideas what is wrong?

Bors
  • 11
  • 2
  • ASP.NET Core is not yet compatible with latest OData Lib https://github.com/OData/WebApi/issues/939 and maybe check this discussion here https://stackoverflow.com/questions/39279552/odata-support-in-asp-net-core. What versions are you using? – Sakis Jul 13 '17 at 13:24
  • I am using Core 1.1 but my problem is not about installation. I was install and develop but Microsoft.AspNet.Odata nuget give me : ODataUnrecognizedPathException: Resource not found for the segment 'sample' this exception on any controllers. – Bors Jul 13 '17 at 14:24

0 Answers0