0

I'm trying to use the DetectAsync method present in faceServiceClient.

using (Stream imageFileStream = webClient.OpenRead(imageFilePath))
{
      var faces = await faceServiceClient.DetectAsync(imageFileStream, returnFaceLandmarks: true, returnFaceAttributes: requiredFaceAttributes);
      var faceAttributes = faces.Select(face => face.FaceAttributes);
      string result = "trying no error";
      faceAttributes.ToList().ForEach(f =>
                     result += $"Age: {f.Age.ToString()} Years  Gender: {f.Gender}  Smile: {f.Smile.ToString()}{Environment.NewLine}{Environment.NewLine}"
                  );
      return result;
}

and the exception is raised at the DetectAsync method

Microsoft.ProjectOxford.Face.FaceAPIException: Exception of type ‘Microsoft.ProjectOxford.Face.FaceAPIException’ was thrown. at Microsoft.ProjectOxford.Face.FaceServiceClient.d__672.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.ProjectOxford.Face.FaceServiceClient.d__29.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at BotFace_Application.Utility.d__1.MoveNext()

Grace Feng
  • 16,564
  • 2
  • 22
  • 45
NSetty
  • 140
  • 11

0 Answers0