鉴于以下内容:
namespace Foo.Controllers
{
[RoutePrefix("api/route")]
public class SnoconesFooBarController : BaseApiController
{
/// <summary>
/// Asks for a new foo to be created to the given subnet with the specific bar named
/// </summary>
/// <param name="fooName"></param>
/// <param name="uriString"></param>
/// <returns></returns>
[Route("newFoo/{fooName}")]
public async Task<IHttpActionResult> PostNewFooForSpecificBar(string fooName, string uriString)
{
}
}
为什么我尝试发帖时会收到404:
http://localhost:4471/api/route/newFoo/test1
使用以下有效负载:
&#34; http://127.0.0.1&#34;
答案 0 :(得分:0)
FWIW,我修改它看起来像这样:
namespace Foo.Controllers
{
[RoutePrefix("api/route")]
public class SnoconesFooBarController : BaseApiController
{
/// <summary>
/// Asks for a new foo to be created to the given subnet with the specific bar named
/// </summary>
/// <param name="fooData"></param>
/// <returns></returns>
[Route("newFoo/")]
public async Task<IHttpActionResult> PostNewFooForSpecificBar(FooRequestObject fooData)
{
}
}
并包含我在FooRequestObject中所需的所有数据