[英]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();
它拋出一個錯誤,說,
找不到資源
我相信您需要在基本URI的末尾添加斜杠,否則將根據此答案丟棄v1.0
。
所以:
var client = new HttpClient { BaseAddress = "https://southcentralus.api.cognitive.microsoft.com/face/v1.0/" };
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.