Microsoft deprecated WCF with the release of .NET 5 and recommends developers transition to more modern technologies. This can be a challenge for those with existing WCF applications who want to migrate to .NET 8.0.
Recently, I received a question about integrating gRPC.NET, a popular modern alternative to WCF, with AutoCAD 2025.
In response, I've created a small application that demonstrates how to interact with a gRPC server from an AutoCAD client.
This sample provides a starting point for developers interested in exploring this integration approach.
The provided code showcases a basic example using a GreeterService
.
Let's break it down:
Client-Side (AutoCAD Plugin):
- The
TestGrpc
method establishes a gRPC channel to a server running onlocalhost:8080
. - It creates a
GreeterClient
object to interact with the gRPC service. - An asynchronous
SayHelloAsync
call is made, sending aHelloRequest
message with the name "GreeterClient". - The response (
HelloReply
) containing the server's greeting is received and written to the active AutoCAD document.
- The
gRPC Service Definition (Protobuf):
- Defines a
Greeter
service with aSayHello
RPC method. - Clients send a
HelloRequest
message with their name. - The server responds with a
HelloReply
containing a greeting.
- Defines a
Server-Side:
- Exposes the
GreeterService
as a gRPC service. - The
SayHello
method receives aHelloRequest
, extracts the name, and constructs a personalized greeting in theHelloReply
message.
- Exposes the
Running the Application
This code creates a combined gRPC and HTTP server. Clients can use gRPC to interact with the GreeterService
, while a basic HTTP endpoint provides a simple test or informational message.
Source Code : https://github.com/MadhukarMoogala/GrpcToAcad/blob/main/README.md
Recent Comments