0

gRPC problem with Windows 11 and IIS: Grpc.Core.RpcException: 'Status(StatusCode="Internal", Detail="Failed to deserialize response message.")

I am trying to host my gRPC service in IIS. But i get this error. "Grpc.Core.RpcException: 'Status(StatusCode="Internal", Detail="Failed to deserialize response message.")'" When I run my gRPC service (debug->start without debugging) it works fine.

I reproduced the problem with te greeter service example.

This is the proto file (client and server):

syntax = "proto3";
option csharp_namespace = "GrpcServiceSimpel";
package greet;
service Greeter {
  rpc SayHello (HelloRequest) returns (HelloReply);
}

message HelloRequest {
  string name = 1;
}

message HelloReply {
  string message = 1;
}

This is the client code (console application).

using Grpc.Net.Client;
using GrpcServiceSImpel;

using var channel = GrpcChannel.ForAddress("https://grpctest.dealerportal.nl/");
var client = new Greeter.GreeterClient(channel);
var reply = await client.SayHelloAsync(new HelloRequest { Name = "GreeterClient" });
Console.WriteLine("Greeting: " + reply.Message);
Console.WriteLine("Press any key to exit...");
Console.ReadKey();

The IIS logging shows this:

#Software: Microsoft Internet Information Services 10.0
#Version: 1.0
#Date: 2022-10-03 12:16:20
#Fields: date time s-sitename s-computername s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs-version cs(User-Agent) cs(Cookie) cs(Referer) cs-host sc-status sc-substatus sc-win32-status sc-bytes cs-bytes time-taken
2022-10-03 12:16:20 W3SVC18 DA-NB30 127.0.0.1 POST /greet.Greeter/SayHello - 443 - 127.0.0.1 HTTP/2 grpc-dotnet/2.49.0+(.NET+6.0.9;+CLR+6.0.9;+net6.0;+windows;+x64) - - grpctest.dealerportal.nl 200 0 0 0 342 2842

I am running windows 11, I tried build 22000 and 22622

  • Is logging only outputting when in debug mode? Where are the log files placed? When running as service to you get any logs? Make sure you can write to log folder when running as a service. Services in Windows run as System and do not have any environment. Best to start a service with Run As and choose an Account with environment or a user account. Usually you crate service account on a machine like a user account and run service from the service account. – jdweng Oct 03 '22 at 12:30
  • According to your description, does this problem only occur in win11 system and in debug mode? Or you could try to disable hot reload and check if this work for you. In VS menu -> Tools -> Options -> Projects and solutions -> ASP.NET Core -> disable CSS hot reload. Just refer to [this similar thread](https://stackoverflow.com/questions/63240268/grpc-core-rpcexception-failed-to-deserialize-response-message-or-invalidope). – Xudong Peng Oct 04 '22 at 08:42
  • Just FYI, according to https://learn.microsoft.com/en-us/aspnet/core/grpc/supported-platforms?view=aspnetcore-6.0#supported-aspnet-core-servers, running gRPC on IIS "Requires .NET 5 and Windows 11 Build 22000 or Windows Server 2022 Build 20348 or later.". (but your setup seems to comply with that). – Jan Tattermusch Oct 14 '22 at 13:55
  • Based on https://developercommunity.visualstudio.com/t/unable-to-debug-grpc-server-code-with-preview-3/1503691#T-N1510110, the unability to debug seems to an issue in Visual Studio 2022 Preview 3. There is a workaround mentioned in that thread. – Jan Tattermusch Oct 14 '22 at 13:57

0 Answers0