<分区>
我正在使用 asp.net web api。我正在尝试从服务器获得肯定的响应,但是程序没有看到 Controller 中的一种方法。它进入 Controller 构造函数,但不会更进一步。 响应是
Status Code 404, Reason Phrase: Not Found.
我知道这可能是方法名称/参数/其他方面的拼写错误,但对我来说一切似乎都很好。我可能忽略了一些事情。
而且 API 工作正常,我已经用不同的方法进行了尝试。
Controller 方法如下:
[HttpGet]
[Route("api/ClientFiles/GetScanStatus")]
[ActionName("GetScanStatus")]
private Tuple<bool, bool?, bool?> GetScanStatus(int scanTypeId, int clientId, int inventoryId)
{
//businessLogic here
return new Tuple<bool, bool?, bool?>(false, null, null);
}
调用 Controller 的方法:
public static async Task<Tuple<bool, bool?, bool?>> GetScanStatus(int scanTypeId, int clientId, int inventoryId)
{
using (HttpClient client = new HttpClient())
{
client.Timeout = new TimeSpan(0, 0, 90);
HttpResponseMessage response = await client.GetAsync($"{ConnectionURL}api/ClientFiles/GetScanStatus/?scanTypeId={scanTypeId}&clientId={clientId}&inventoryId={inventoryId}").ConfigureAwait(false);
if (response.IsSuccessStatusCode)
{
var result = await response.Content.ReadAsAsync<Tuple<bool, bool?, bool?>>();
return result;
}
}
return null;
}
response.RequestedUri
是
http://localhost:61372/api/ClientFiles/GetScanStatus/?scanTypeId=26&clientId=12&inventoryId=25482