未找到 Azure 认知服务(人脸检测 API)returns 资源

Azure Cognitive service (Face detection API) returns resource not found

我为人脸检测认知服务创建了一个单独的资源api,它给出了如下端点,

https://southcentralus.api.cognitive.microsoft.com/face/v1.0

所以在提出如下请求时,

var byteContent = new ByteArrayContent(fileContents);
byteContent.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
var response = await _client.PostAsync("detect?returnFaceId=true&returnFaceAttributes=age,gender,smile,facialHair,glasses,headPose,emotion,hair,makeup,occlusion,accessories,blur,exposure,noise", byteContent);
var responseJson = await response.Content.ReadAsStringAsync();

它抛出一个错误说,

Resource Not Found

我认为您需要在基本 URI 的末尾添加尾部斜线,否则 v1.0 将按照 this answer.

被丢弃

所以:

var client = new HttpClient { BaseAddress = "https://southcentralus.api.cognitive.microsoft.com/face/v1.0/" };