ailab icon indicating copy to clipboard operation
ailab copied to clipboard

Getting an error every time I try to upload the test data via dotnet

Open aenony opened this issue 5 years ago • 5 comments

Unhandled Exception: Microsoft.Rest.HttpOperationException: Operation returned an invalid status code 'Unauthorized' at Microsoft.Azure.CognitiveServices.Vision.CustomVision.Training.TrainingApi.GetDomainsWithHttpMessagesAsync(Dictionary`2 customHeaders, CancellationToken cancellationToken) at Microsoft.Azure.CognitiveServices.Vision.CustomVision.Training.TrainingApiExtensions.GetDomainsAsync(ITrainingApi operations, CancellationToken cancellationToken) at Microsoft.Azure.CognitiveServices.Vision.CustomVision.Training.TrainingApiExtensions.GetDomains(ITrainingApi operations) at Import.Program.Main(String[] args) in ~/AISchoolTutorials-master/sketch2code/Import/Program.cs:line 29

I keep getting this error when I try to upload the JSON data. My key is correct although in step 2 in the tutorial I couldn't complete steps 10,11,12 as there is no notepad in the quick settings tab.

Any help is greatly appreciated. Thanks!

aenony avatar Nov 05 '19 19:11 aenony

Can someone help here?

saurabhksinha900 avatar Jan 12 '20 15:01 saurabhksinha900

Getting same error..

snailmail123 avatar May 16 '20 05:05 snailmail123

same any solution?

harrybanda avatar Jul 10 '20 09:07 harrybanda

The solution that worked for me:

  1. Open your terminal and go to Import folder
  2. paste this dotnet add package Microsoft.Azure.CognitiveServices.Vision.CustomVision.Training --version 2.0.0 this will update the CustomVision package.
  3. Open Program.cs and replace this line TrainingApi trainingApi = new TrainingApi() { ApiKey = trainingKey }; with this line CustomVisionTrainingClient trainingApi = new CustomVisionTrainingClient(new Microsoft.Azure.CognitiveServices.Vision.CustomVision.Training.ApiKeyServiceClientCredentials(trainingKey)) {Endpoint = ENDPOINT}; makesure to replace ENDPOINT with your yours from customvision.ai

harrybanda avatar Jul 12 '20 09:07 harrybanda

The solution that worked for me:

  1. Open your terminal and go to Import folder
  2. paste this dotnet add package Microsoft.Azure.CognitiveServices.Vision.CustomVision.Training --version 2.0.0 this will update the CustomVision package.
  3. Open Program.cs and replace this line TrainingApi trainingApi = new TrainingApi() { ApiKey = trainingKey }; with this line CustomVisionTrainingClient trainingApi = new CustomVisionTrainingClient(new Microsoft.Azure.CognitiveServices.Vision.CustomVision.Training.ApiKeyServiceClientCredentials(trainingKey)) {Endpoint = ENDPOINT}; makesure to replace ENDPOINT with your yours from customvision.ai

getting some errors while giving the endpoint , how to resolve this. error

P-S-S-VARUN avatar Mar 31 '22 06:03 P-S-S-VARUN