Debugging gRPC server components inside a .NET application
An ASP.NET Core application with gRPC capabilities allows you to get gRPC middleware to output internal debugging information to the application console. It is switched off by default, but we can turn it on by applying a simple change to the application settings.
Likewise, the gRPC server application allows you to use interceptors, just like we did on the client. The server-side interceptor would inherit from the same base class as the client-side one, but it will have different methods defined in it that are only applicable to the server-side events:
- To enable the debug log from the gRPC middleware to be printed in the console, you would need to open the
appsettings.json
file (andappsettings.Development.json
, if you have it) in theIotDeviceManager
project folder, locate theLogLevel
section, and insert the following entry within it:"Grpc": "Debug"
- Now, we will add our server-side interceptor...