简体   繁体   English

Azure认知服务(面部检测API)返回找不到资源

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

I have created a separate resource for face detection cognitive service api and it gives the endpoint as follows, 我为面部检测认知服务api创建了一个单独的资源,它为端点提供了以下内容,

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

so while making request like below, 因此,在发出如下请求时,

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();

it throws an error saying, 它抛出一个错误,说,

Resource Not Found 找不到资源

I believe you need to add trailing slash to end of your base URI otherwise the v1.0 will be discarded as per this answer . 我相信您需要在基本URI的末尾添加斜杠,否则将根据此答案丢弃v1.0

So: 所以:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM