Google.Cloud.Speech Получил заголовок http2 со статусом: 404 - PullRequest
0 голосов
/ 08 апреля 2020

Я использую C# Google.Cloud.Speech.V1. NET клиентскую библиотеку версию 2.0.0 для Google Cloud Speech API .

Я хочу получить статус операции longRunningRecognize с OperationsClient :

var operationsClient = new OperationsClientBuilder { CredentialsPath = "GoogleServiceAccount.json" }.Build();
var operation = operationsClient.GetOperation("3637912932635009144");

Но я получаю это исключение:

Grpc.Core.RpcException: Status(StatusCode=Cancelled, Detail="Received http2 header with status: 404")

Я использую SpeechClient и StorageClient с учетными данными ServiceAccount (GoogleServiceAccount. json) и все работает нормально.

Я проверил операции с Google Cloud SDK Shell и тоже хорошо:

gcloud ml speech operations describe 3637912932635009144

Любая помощь будет принята с благодарностью.

Вот StackTrace:

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Grpc.Core.Internal.AsyncCall`2.UnaryCall(TRequest msg)
   at Grpc.Core.Calls.BlockingUnaryCall[TRequest,TResponse](CallInvocationDetails`2 call, TRequest req)
   at Grpc.Core.DefaultCallInvoker.BlockingUnaryCall[TRequest,TResponse](Method`2 method, String host, CallOptions options, TRequest request)
   at Grpc.Core.Interceptors.InterceptingCallInvoker.<BlockingUnaryCall>b__3_0[TRequest,TResponse](TRequest req, ClientInterceptorContext`2 ctx)
   at Grpc.Core.ClientBase.ClientBaseConfiguration.ClientBaseConfigurationInterceptor.BlockingUnaryCall[TRequest,TResponse](TRequest request, ClientInterceptorContext`2 context, BlockingUnaryCallContinuation`2 continuation)
   at Grpc.Core.Interceptors.InterceptingCallInvoker.BlockingUnaryCall[TRequest,TResponse](Method`2 method, String host, CallOptions options, TRequest request)
   at Google.LongRunning.Operations.OperationsClient.GetOperation(GetOperationRequest request, CallOptions options)
   at Google.Api.Gax.Grpc.ApiCall.GrpcCallAdapter`2.CallSync(TRequest request, CallSettings callSettings)
   at Google.Api.Gax.Grpc.ApiCallRetryExtensions.<>c__DisplayClass1_0`2.<WithRetry>b__0(TRequest request, CallSettings callSettings)
   at Google.Api.Gax.Grpc.ApiCall`2.<>c__DisplayClass10_0.<WithCallSettingsOverlay>b__1(TRequest req, CallSettings cs)
   at Google.Api.Gax.Grpc.ApiCall`2.Sync(TRequest request, CallSettings perCallCallSettings)
   at Google.LongRunning.OperationsClientImpl.GetOperation(GetOperationRequest request, CallSettings callSettings)
   at Google.LongRunning.OperationsClient.GetOperation(String name, CallSettings callSettings)
   at TranscripcionAPI.Controllers.WeatherForecastController.GetResult(String operationName) in C:\Users\andresfelipe\source\repos\TranscripcionAPI\TranscripcionAPI\TranscripcionAPI\Controllers\WeatherForecastController.cs:line 146

1 Ответ

0 голосов
/ 09 апреля 2020

Я опубликовал вопрос об этом на github.

Я неправильно использовал библиотеку.

Правильный способ запроса операции:

var speech = new SpeechClientBuilder { CredentialsPath = "GoogleServiceAccount.json" }.Build();
var operation = speech.PollOnceLongRunningRecognize(operationName);

Ответ вы можете увидеть здесь:

https://github.com/googleapis/google-cloud-dotnet/issues/4843

...