Skip to content

Instantly share code, notes, and snippets.

@gistlyn
Last active May 17, 2020 04:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gistlyn/656c29a7257dc374d22d4aa709ba7244 to your computer and use it in GitHub Desktop.
Save gistlyn/656c29a7257dc374d22d4aa709ba7244 to your computer and use it in GitHub Desktop.
Configure gRPC (requires .NET Core 3.1)
dotnet add package ServiceStack.Extensions
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using ServiceStack;
namespace MyApp
{
[Priority(-1)]
public class ConfigureGrpc : IConfigureServices, IConfigureApp, IConfigureAppHost
{
public void Configure(IServiceCollection services)
{
services.AddServiceStackGrpc();
}
public void Configure(IApplicationBuilder app)
{
app.UseRouting();
}
public void Configure(IAppHost appHost)
{
appHost.Plugins.Add(new GrpcFeature(appHost.GetApp()));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment