microsoft / Cognitive-Face-iOS

iOS SDK for the Microsoft Face API, part of Cognitive Services
https://www.microsoft.com/cognitive-services/en-us/face-api
Other
184 stars 64 forks source link

What cause the error with code 404 ? #37

Closed wang3t closed 7 years ago

wang3t commented 7 years ago
  1. Clone the repo.
  2. Insert subscription key for the Face API MPOAppDelegate.h (Verified @ 5)
  3. re-run pop install @ Cognitive-Face-iOS/Example
  4. run on device but seeing error while it detecting face at
    • (void)detectAction: (id)sender { => [client detectWithData:data returnFaceId:YES ....] completionBlock:^() { ... } }
  5. Verified EndPoint/Key EndPpoin:https://westus.api.cognitive.microsoft.com/face/v1.0; KEY:xxxx

error NSError * domain: @"POFaceServiceClient error - http response is not success : { \"statusCode\": 404, \"message\": \"Resource not found\" }" - code: 404 0x00000001c4251f70

  1. Before the error, there is another log ... ProjectOxfordFace_Example[299:14136] [discovery] errors encountered while discovering extensions: Error Domain=PlugInKit Code=13 "query cancelled" UserInfo={NSLocalizedDescription=query cancelled}

Q: What cause the error with code 404 ? Am I missing something (UserInfo?)

huxuan commented 7 years ago

@wang3t It seems that you missed the trailing slash and at the end of endpoint.

wang3t commented 7 years ago

Found the issue, missing the closing "/". Modified : EndPpoin:https://westus.api.cognitive.microsoft.com/face/v1.0/

Closing.

MrMit007 commented 6 years ago

missing the closing "/" It saved my life ;p

PiyalGeorge commented 4 years ago

In python simply this worked for me. ENDPOINT='https://westcentralus.api.cognitive.microsoft.com'

theCuriousHAT commented 4 years ago

Even after putting slash in my endpoint at the end, I am still facing the issue.

Encountered exception. (404) Resource not found

roninstar commented 4 years ago

I am having the same issue as well using the exact example and in westus and using the trailing "/" yet still I keep getting 404 Resource not found using Cognitive Services. I tried creating from Endpoint and from Subscription with the same error. string subscriptionKey = _azuresubscriptionKey; string region = _azureRegion; var azureSpeechServiceUri = new Uri(_azureSpeechServicesPath); // var config = SpeechConfig.FromSubscription(subscriptionKey, region);

        var config = SpeechConfig.FromEndpoint(azureSpeechServiceUri, subscriptionKey);
        config.SpeechRecognitionLanguage = "en-us";

        // persist profileMapping if you want to store a record of who the profile is
        var profileMapping = new Dictionary<string, string>();
        await VerificationEnroll(config, profileMapping);

The createProfileAsync always returns an empty Profile Id.

var client = new VoiceProfileClient(config); var profile = await client.CreateProfileAsync(VoiceProfileType.TextIndependentVerification, "en-us");

        var audioInput = AudioConfig.FromDefaultMicrophoneInput();

                CurrentInstructions.Text = $"Enrolling profile id {profile.Id}.";
        // give the profile a human-readable display name

                profileMapping.Add(profile.Id, "Mark");

                VoiceProfileEnrollmentResult result = null;
                while (result is null || result.RemainingEnrollmentsSpeechLength > TimeSpan.Zero)
                {
                    CurrentInstructions.Text = "Continue speaking to add to the profile enrollment sample.";
                    result = await client.EnrollProfileAsync(profile, audioInput);
                    CurrentInstructions.Text = $"Remaining enrollment audio time needed: {result.RemainingEnrollmentsSpeechLength}";

                }

                if (result.Reason == ResultReason.EnrolledVoiceProfile)
                {
                    await SpeakerVerify(config, profile, profileMapping);
                }
                else if (result.Reason == ResultReason.Canceled)
                {
                    var cancellation = VoiceProfileEnrollmentCancellationDetails.FromResult(result);
                    CurrentInstructions.Text = $"CANCELED {profile.Id}: ErrorCode={cancellation.ErrorCode} ErrorDetails={cancellation.ErrorDetails}";
                }