Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
aenony opened this issue Nov 5, 2019 · 4 comments
Open

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

aenony opened this issue Nov 5, 2019 · 4 comments

Comments

@aenony
Copy link

@aenony aenony commented Nov 5, 2019

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!

@saurabhksinha900
Copy link

@saurabhksinha900 saurabhksinha900 commented Jan 12, 2020

Can someone help here?

@hello-evan1234
Copy link

@hello-evan1234 hello-evan1234 commented May 16, 2020

Getting same error..

@harrybanda
Copy link

@harrybanda harrybanda commented Jul 10, 2020

same any solution?

@harrybanda
Copy link

@harrybanda harrybanda commented Jul 12, 2020

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.