簡體   English   中英

Google.Cloud.Speech 收到 http2 header 狀態:404

[英]Google.Cloud.Speech Received http2 header with status: 404

我正在為Google Cloud Speech API使用 C# Google.Cloud.Speech.V1 .NET 客戶端庫版本 2.0.0。

我想使用OperationsClient獲取longRunningRecognize的操作狀態:

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")

我使用SpeechClientStorageClientServiceAccount 憑據(GoogleServiceAccount.json) ,一切正常。

我已經使用Google Cloud SDK Shell驗證了操作,也很好:

gcloud ml speech operations describe 3637912932635009144

任何幫助將不勝感激。

這是堆棧跟蹤:

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

我在 github 上發布了一個關於此的問題。

我以錯誤的方式使用圖書館。

查詢操作的正確方法是:

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

你可以在這里看到答案:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM