如何将 OData 配置为在配置了 ODataAttributeRouting 的端点上使用 POST 和 /$query?我得到一个 404
How do I configure OData to use a POST with /$query on an endpoint configured with ODataAttributeRouting? I'm getting a 404
这是 OData AspNetCore support for long URLs useing $query is not working 的后续。
OData 8.0.4
在启动时,我有 app.UseODataQueryRequest()
我的控制器看起来像
[ODataAttributeRouting]
public class ODataQueryController : Controller
{
[HttpGet] // not needed, it turns out
[EnableQuery]
[Route("Thing")]
public IActionResult GetThings()
{
return Ok(ApplicationContext.Things);
}
}
我的POST看起来像
POST http://localhost:8080/api/odata/Thing/$query
Request Body: $select=Column
Content-Type: text/plain
然后我收到 404
将 app.UseODataQueryRequest()
放在 app.UseRouting()
之前为我解决了这个问题
Startup.cs:
...
app.UseODataQueryRequest();
...
app.UseRouting();
...
这是 OData AspNetCore support for long URLs useing $query is not working 的后续。
OData 8.0.4
在启动时,我有 app.UseODataQueryRequest()
我的控制器看起来像
[ODataAttributeRouting]
public class ODataQueryController : Controller
{
[HttpGet] // not needed, it turns out
[EnableQuery]
[Route("Thing")]
public IActionResult GetThings()
{
return Ok(ApplicationContext.Things);
}
}
我的POST看起来像
POST http://localhost:8080/api/odata/Thing/$query
Request Body: $select=Column
Content-Type: text/plain
然后我收到 404
将 app.UseODataQueryRequest()
放在 app.UseRouting()
之前为我解决了这个问题
Startup.cs:
...
app.UseODataQueryRequest();
...
app.UseRouting();
...