title: Grpc.Core.RpcException: Status(StatusCode=Unavailable, Detail="Transport closed")
body: <p>I'm using Google custom metric to write custom metrics to the cloud. My code looks like this: </p>
  
  <pre><code>var client = MetricServiceClient.Create();
  // ... 
  client.CreateTimeSeries(name, timeSeries);
  </code></pre>
  
  <p>When I running it on my machine, it's working great. </p>
  
  <p>When I running it on production, it works great until stopped. I'm getting this error message:</p>
  
  <pre><code>Grpc.Core.RpcException: Status(StatusCode=Unavailable, Detail="Transport closed")
     at Grpc.Core.Internal.AsyncCall`2.UnaryCall(TRequest msg)
     at Grpc.Core.DefaultCallInvoker.BlockingUnaryCall[TRequest,TResponse](Method`2 method, String host, CallOptions options, TRequest request)
     at Grpc.Core.Interceptors.InterceptingCallInvoker.&lt;BlockingUnaryCall&gt;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.Cloud.Monitoring.V3.MetricService.MetricServiceClient.CreateTimeSeries(CreateTimeSeriesRequest request, CallOptions options)
     at Google.Api.Gax.Grpc.ApiCall.GrpcCallAdapter`2.CallSync(TRequest request, CallSettings callSettings)
     at Google.Api.Gax.Grpc.ApiCallRetryExtensions.&lt;&gt;c__DisplayClass1_0`2.&lt;WithRetry&gt;b__0(TRequest request, CallSettings callSettings)
     at Google.Cloud.Monitoring.V3.MetricServiceClientImpl.CreateTimeSeries(CreateTimeSeriesRequest request, CallSettings callSettings)
     at XXX in XXX.cs:line 90
  </code></pre>
  
  <p>or this similar error:</p>
  
  <pre><code>Grpc.Core.RpcException: Status(StatusCode=Unavailable, Detail="Socket closed")
     at Grpc.Core.Internal.AsyncCall`2.UnaryCall(TRequest msg)
     at Grpc.Core.DefaultCallInvoker.BlockingUnaryCall[TRequest,TResponse](Method`2 method, String host, CallOptions options, TRequest request)
     at Grpc.Core.Interceptors.InterceptingCallInvoker.&lt;BlockingUnaryCall&gt;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.Cloud.Monitoring.V3.MetricService.MetricServiceClient.CreateTimeSeries(CreateTimeSeriesRequest request, CallOptions options)
     at Google.Api.Gax.Grpc.ApiCall.GrpcCallAdapter`2.CallSync(TRequest request, CallSettings callSettings)
     at Google.Api.Gax.Grpc.ApiCallRetryExtensions.&lt;&gt;c__DisplayClass1_0`2.&lt;WithRetry&gt;b__0(TRequest request, CallSettings callSettings)
     at Google.Cloud.Monitoring.V3.MetricServiceClientImpl.CreateTimeSeries(CreateTimeSeriesRequest request, CallSettings callSettings)
  </code></pre>
  
  <p>This error repeating from time to time. It looks like 99% of the time it's working. </p>
  
  <p>What the problem here? How to solve it? </p>