Azure / azure-sdk-for-net

This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/dotnet/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-net.
MIT License
5.37k stars 4.78k forks source link

[BUG] CustomVision.Prediction client always returns NotFound #5485

Closed bzglm closed 4 years ago

bzglm commented 5 years ago

Describe the bug The Microsoft.Azure.CognitiveServices.Vision.CustomVision.Prediction nuget package always throws an exception when trying to reach the CustomVision API ("Microsoft.Rest.HttpOperationException: 'Operation returned an invalid status code 'NotFound''), no matter the endpoint or the method (trying to to list projects does not work either)

Exception or Stack Trace at Microsoft.Azure.CognitiveServices.Vision.CustomVision.Prediction.CustomVisionPredictionClient.d26.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.Azure.CognitiveServices.Vision.CustomVision.Prediction.CustomVisionPredictionClientExtensions.d4.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.Azure.CognitiveServices.Vision.CustomVision.Prediction.CustomVisionPredictionClientExtensions.PredictImage(ICustomVisionPredictionClient operations, Guid projectId, Stream imageData, Nullable`1 iterationId, String application)

Code Snippet HttpClient httpClient = new HttpClient(); CustomVisionPredictionClient customVisionPredictionClient = new CustomVisionPredictionClient(httpClient, false) { ApiKey = PredictionKey, Endpoint = PredictionEndpoint, }; using (var imageData = new FileStream(@"d:\input.png", FileMode.Open)) { var result = customVisionPredictionClient.PredictImage(ProjectGuid, imageData); }

Setup (please complete the following information):

Additional context As suggested on another bug report I have set a default iteration but that did not solve the issue (neither did providing its GUID as parameter). I have also tried several different endpoints for the API with no more success. Lastly I was able to reach the API using the deprecated Windows client library ( https://github.com/Microsoft/Cognitive-CustomVision-Windows/tree/master/ClientLibrary ) through the provided Windows sample. I have tried setting the exact same endpoint and obviously the correct information about my project but without getting more success.

kurtzeborn commented 5 years ago

Thank you for opening this issue! We are routing it to the appropriate team for follow up.

davidlfox commented 5 years ago

Has the UI to set an iteration as default been removed from the customvision.ai portal?

nrobert commented 5 years ago

One thing, just to be sure: what value did you put in PredictionEndpoint field?

jongio commented 4 years ago

Closing due to inactivity. Please re-open if you still have an issue with the new libraries: https://aka.ms/azsdk