title: Error when executing service method 'getStats'
body: <p>Im trying to do a client-server streaming and when I try to stream from the client to the server this error logs in server console: Error when executing service method 'getStats'.
  System.InvalidOperationException: Unable to resolve service for type 'System.Object' while attempting to activate 't_stat_grpc.Services.HotelStatService'.</p>
  <p><em><strong>getStats method</strong></em></p>
  <pre><code>public class HotelStatService : hotelStat.hotelStatBase
  {
      private readonly ILogger&lt;HotelStatService&gt; _logger;
      public HotelStatService(ILogger&lt;HotelStatService&gt; logger, object httpClientFactory)
      {
          _logger = logger;
      }
      
      public override async Task&lt;dataToServer&gt; getStats(IAsyncStreamReader&lt;dataToServer&gt; requestStream, ServerCallContext context)
      {
          var response = null as dataToServer;
  
          var config = new MapperConfiguration(cfg =&gt; {
              cfg.CreateMap&lt;dataToServer, dataToServer&gt;();
          });
  
          IMapper mapper = config.CreateMapper();
  
          await foreach(var request in requestStream.ReadAllAsync())
          {
              response = mapper.Map&lt;dataToServer&gt;(request);
          }
          return response;
      }
  }
  </code></pre>
  <p><strong>This is where I call it</strong></p>
  <pre><code>while (true)
          {
              Console.WriteLine(&quot;Clique enter para enviar os dados para o servidor&quot;);
              Console.ReadLine();
              Console.WriteLine(&quot;Conectando ao servidor...&quot;);
              var channel = GrpcChannel.ForAddress(&quot;https://localhost:5002&quot;);
              var client = new hotelStat.hotelStatClient(channel);
              var stream = client.getStats();
              Console.WriteLine(&quot;Conectado&quot;);
              Console.WriteLine(&quot;A enviar dados para o servidor...&quot;);
              string connectionString = $&quot;Data Source=(localhost);Initial Catalog=hotel;Integrated Security=True&quot;;
              SqlConnection connection = new SqlConnection(connectionString);
              connection.Open();
  
              var listaStats = connection.Query&lt;dataToServer&gt;(&quot;SELECT top(5) * FROM t_stat&quot;).ToList();
              
              foreach (var item in listaStats)
              {
                  try
                  {
                      var data = mapper.Map&lt;dataToServer&gt;(item);
                      await stream.RequestStream.WriteAsync(data);
                  }
                  catch (Exception e)
                  {
                      Console.WriteLine(e.Message);
                  }
              }
              Console.WriteLine(&quot;Dados enviados com sucesso!&quot;);
              Console.WriteLine(&quot;Disconectando...&quot;);
              connection.Close();
          }
  </code></pre>
  <p>(If you need to check any code, just ask I will be able to show you)</p>