gRPC for .NET
Go to file
Shimmy d07efb500c
Add protobuf-net code-first to README.md (#2644)
Co-authored-by: James Newton-King <james@newtonking.com>
2025-06-26 08:39:36 +08:00
.github Avoid using ConcurrentDictionary for channels with few methods (#2597) 2025-02-19 07:17:50 +08:00
build Bump version on master to 2.66.0-dev (#2491) 2024-07-19 18:39:01 -07:00
doc bump Grpc.Tools 2024-02-07 21:07:42 +00:00
docfx Attempt to add scripts for generating API docs (#531) 2019-09-23 07:47:32 +02:00
examples Bump pbkdf2 from 3.1.2 to 3.1.3 in /examples/Spar/Server/ClientApp (#2642) 2025-06-24 13:43:24 +08:00
keys Migration cleanup 2019-01-31 16:22:50 -08:00
kokoro Remove internal_ci flag from interop test script (#2509) 2024-08-16 17:13:23 +08:00
perf Fix shared code (#2640) 2025-06-24 11:39:09 +08:00
src Fix shared code (#2640) 2025-06-24 11:39:09 +08:00
test Fix shared code (#2640) 2025-06-24 11:39:09 +08:00
testassets Bump brace-expansion in /testassets/InteropTestsGrpcWebWebsite/Tests (#2639) 2025-06-13 11:10:16 +08:00
.dockerignore Add gRPC-Web Blazor interop tests (#859) 2020-04-29 10:25:08 +12:00
.editorconfig Add .editorconfig and fix warnings (#2055) 2023-02-25 21:43:59 +08:00
.gitattributes Add scripts to setup and update local feeds 2019-02-04 15:41:06 -08:00
.gitignore Update .NET 9 SDK and resolve warnings (#2502) 2024-08-14 12:08:04 +08:00
AUTHORS Create AUTHORS file 2018-11-29 17:40:24 +01:00
CODE-OF-CONDUCT.md initial repo setup 2018-11-28 21:24:01 +01:00
CONTRIBUTING.md Add GOVERNANCE.md and CONTRIBUTING.md (#554) 2019-09-27 12:20:50 +12:00
Directory.Build.props Update repo for .NET 9 (#2457) 2024-06-13 11:05:43 +08:00
Directory.Build.targets Update various package versions (#2453) 2024-06-06 08:14:59 +08:00
Directory.Packages.props Update NuGet package versions (#2620) 2025-04-10 08:45:17 +08:00
GOVERNANCE.md Add GOVERNANCE.md and CONTRIBUTING.md (#554) 2019-09-27 12:20:50 +12:00
Grpc.DotNet.ruleset Add code analysis (#463) 2019-08-21 06:34:51 +12:00
Grpc.DotNet.slnx Migrate from sln to slnx (#2635) 2025-05-30 11:24:19 +08:00
LICENSE initial repo setup 2018-11-28 21:24:01 +01:00
MAINTAINERS.md [vote]Added Active maintainers into MAINTAINERS.md. (#2449) 2024-12-09 08:49:13 +08:00
README.md Add protobuf-net code-first to README.md (#2644) 2025-06-26 08:39:36 +08:00
TROUBLESHOOTING.md Add GitHub issue templates and TROUBLESHOOTING.md (#568) 2019-10-01 20:40:11 +13:00
activate.ps1 Update development infrastructure (#205) 2019-04-11 12:26:50 -07:00
activate.sh Update development infrastructure (#205) 2019-04-11 12:26:50 -07:00
build_and_test.sh Migrate from sln to slnx (#2635) 2025-05-30 11:24:19 +08:00
docker-compose.yml Update puppeteer (#2507) 2024-08-15 08:23:06 +08:00
global.json Migrate from sln to slnx (#2635) 2025-05-30 11:24:19 +08:00
grpcweb_interoptests.sh Update .NET 9 SDK and resolve warnings (#2502) 2024-08-14 12:08:04 +08:00
microsoft-support.md Update microsoft-support.md (#2403) 2024-04-05 06:09:28 +08:00
nuget.config Remove old dotnet-core feed (#2611) 2025-03-07 07:33:39 +08:00
packageIcon.png Update global tool and resolve build warnings. (#539) 2019-09-23 16:18:39 -07:00
startvs.cmd Rename Grpc.AspNetCore.sln to Grpc.DotNet.sln (#314) 2019-06-11 14:54:19 +02:00

README.md

gRPC for .NET

gRPC is a modern, open source, high-performance remote procedure call (RPC) framework that can run anywhere. gRPC enables client and server applications to communicate transparently, and simplifies the building of connected systems.

gRPC functionality for .NET Core 3.0 or later includes:

  • Grpc.AspNetCore An ASP.NET Core framework for hosting gRPC services. gRPC on ASP.NET Core integrates with standard ASP.NET Core features like logging, dependency injection (DI), authentication and authorization.
  • Grpc.Net.Client A gRPC client for .NET Core that builds upon the familiar HttpClient. The client uses new HTTP/2 functionality in .NET Core.
  • Grpc.Net.ClientFactory gRPC client integration with HttpClientFactory. The client factory allows gRPC clients to be centrally configured and injected into your app with DI.

For more information, see An introduction to gRPC on .NET.

Starting from May 2021, gRPC for .NET is the recommended implemention of gRPC for C#. The original gRPC for C# implementation (distributed as the Grpc.Core nuget package) is now in maintenance mode and will be deprecated in the future. See blogpost for more details.

To start using gRPC for .NET

The best place to start using gRPC for .NET is the gRPC template that comes with .NET Core 3.0 or later. Use the template to create a gRPC service website and client.

For additional examples of using gRPC in .NET refer to https://github.com/grpc/grpc-dotnet/tree/master/examples.

gRPC NuGet feed

Official versions of gRPC are published to NuGet.org. This is the recommended place for most developers to get gRPC packages.

Nightly versions of gRPC for ASP.NET Core are published to the gRPC NuGet repository at https://grpc.jfrog.io/grpc/api/nuget/v3/grpc-nuget-dev. It is recommended to use a nightly gRPC package if you are using a nightly version of .NET Core, and vice-versa. There may be incompatibilities between .NET Core and gRPC for ASP.NET Core if a newer version of one is used with an older version of the other.

To use the gRPC NuGet repository and get the latest packages from it, place a NuGet.config file with the gRPC repository setup in your solution folder:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <packageSources>
        <!-- Add this repository to the list of available repositories -->
        <add key="gRPC repository" value="https://grpc.jfrog.io/grpc/api/nuget/v3/grpc-nuget-dev" />
    </packageSources>
</configuration>

Additional instructions for configuring a project to use a custom NuGet repository are available at Changing NuGet configuration settings.

To develop gRPC for ASP.NET Core

Installing .NET Core SDK:

# Run this script before building the project.
./build/get-dotnet.sh or ./build/get-dotnet.ps1

Set up the development environment to use the installed .NET Core SDK:

# Source this script to use the installed .NET Core SDK.
source ./activate.sh or . ./activate.ps1

To launch Visual Studio with the installed SDK:

# activate.sh or activate.ps1 must be sourced first, see previous step
startvs.cmd

To build from the command line:

dotnet build Grpc.DotNet.sln

To run tests from the command line:

dotnet test Grpc.DotNet.sln

Alternative implementation using Code-First (external library)

An alternative way to use gRPC in .NET is to define the Protobuf contracts directly in C# using protobuf-net.

For more information, see the documentation on learn.microsoft.com or the protobuf-net.Grpc website.

To contribute

Contributions are welcome!

General rules for contributing to the gRPC project apply for this repository.