Last active
May 17, 2020 04:21
-
-
Save gistlyn/656c29a7257dc374d22d4aa709ba7244 to your computer and use it in GitHub Desktop.
Configure gRPC (requires .NET Core 3.1)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dotnet add package ServiceStack.Extensions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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