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

WPF sample builds and runs but throws exception on Analyze #19

Closed
briannoyes opened this issue May 21, 2017 · 8 comments
Closed

WPF sample builds and runs but throws exception on Analyze #19

briannoyes opened this issue May 21, 2017 · 8 comments

Comments

@briannoyes
Copy link

Here is what gets dumped in the console:
[16:11:51.353827]: VisionServiceClient is created
[16:11:51.355825]: Calling VisionServiceClient.AnalyzeImageAsync()...
[16:11:53.596602]: Microsoft.ProjectOxford.Vision.ClientException: Exception of type 'Microsoft.ProjectOxford.Vision.ClientException' was thrown.
at Microsoft.ProjectOxford.Vision.VisionServiceClient.HandleException(Exception exception)
at Microsoft.ProjectOxford.Vision.VisionServiceClient.b__42_1[TRequest,TResponse](Exception e)
at System.AggregateException.Handle(Func2 predicate) at Microsoft.ProjectOxford.Vision.VisionServiceClient.<SendAsync>d__422.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.Vision.VisionServiceClient.d__211.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.Vision.VisionServiceClient.<AnalyzeImageAsync>d__20.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 VisionAPI_WPF_Samples.AnalyzePage.d__1.MoveNext() in C:\Demos\Cortana\Cognitive-Vision-Windows\Sample-WPF\AnalyzePage.xaml.cs:line 86
--- 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.TaskAwaiter`1.GetResult()
at VisionAPI_WPF_Samples.AnalyzePage.d__3.MoveNext() in C:\Demos\Cortana\Cognitive-Vision-Windows\Sample-WPF\AnalyzePage.xaml.cs:line 141
--- 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.TaskAwaiter.GetResult()
at VisionAPI_WPF_Samples.ImageScenarioPage.d__15.MoveNext() in C:\Demos\Cortana\Cognitive-Vision-Windows\Sample-WPF\ImageScenarioPage.cs:line 90

@VergaraF
Copy link

I am on the same boat. It throws an exception on every feature. When I tried OCR, it says my key is not valid but I am literally copying and pasting from the Microsoft website... the key is indeed valid.

@VergaraF
Copy link

The error is somewhere on the api key. Despite being given an official key from Microsoft, the request doesn't accept it. I get a 401 error.

@cthrash
Copy link
Contributor

cthrash commented May 22, 2017

Are either of you using the 'Try Free' API key? If so, you must use the VisionServiceClient.ctor override, and provide the host address (2nd arg) of https://westcentralus.api.cognitive.microsoft.com/vision/v1.0.

@briannoyes
Copy link
Author

Aligning the region my keys were for with the region being called fixed the problem for me. Since the region being called is buried in the code, I'd suggest making that a prompt along with the key, or somehow make it clear that the code has a specific region buried in the code that they will need to change if their keys are from a different region.

@chsienki
Copy link
Contributor

chsienki commented Jun 2, 2017

Thanks @briannoyes This was a recent change, and we haven't yet updated the sample apps to support the region specificity, its on our backlog and we'll update the apps to prompt for a region in the future.

@cthrash
Copy link
Contributor

cthrash commented Jun 2, 2017

I haven't had the time to try it, but does this solve the issue? Worth a try

@briannoyes
Copy link
Author

yep, looks like that will help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants