我目前希望冒险的人可能已经解决了这个障碍,因为在ASP.Net v5.0上运行的MVC 6的当前版本没有任何我能找到的将OData加载到管道中的服务.我调用app.UseMvc()并可以构造约定路由,但不能在新进程中定义任何HttpConfiguration对象.我真的希望能够在MVC 6中使用MVC/WebApi,但OData v4是一个改变游戏规则的游戏.
如果有人有经验并且可以指出我正确的方向,请告知:
它可能没什么用,但这是我的Startup类:
using System;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Http;
using Microsoft.Data.OData;
// Won't work, but needs using System.Web.OData.Builder;
using Microsoft.Framework.DependencyInjection;
namespace bmiAPI
{
public class Startup
{
public void Configure(IApplicationBuilder app)
{
app.UseWelcomePage();
app.UseMvc();
}
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
}
}
}
Run Code Online (Sandbox Code Playgroud)