Giter VIP home page Giter VIP logo

grpcsamples's Introduction

gRPC Samples

Samples showing how to run a gRPC server in a WPF application and as a standalone server running in IIS (Kestrel and IIS running on different ports). WPF has a known issue generating the appropriate gRPC and proto files (see https://docs.microsoft.com/en-us/aspnet/core/grpc/troubleshoot?view=aspnetcore-3.0#wpf-projects-unable-to-generate-grpc-c-assets-from-proto-files) so the gRPC service is in a class library. Code generation works fine in web projects but I wanted to share the code.

grpcsamples's People

Contributors

alexbagnolini avatar davidfowl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

grpcsamples's Issues

StopAsync calling StartAsync

In file GrpServer.cs, the StopAsync method:

        public Task StopAsync(CancellationToken cancellationToken)
        {
            return _host?.StartAsync() ?? Task.CompletedTask;
        }

Should be

        _host?.StopAsync(cancellationToken) ?? Task.CompletedTask;

instead.

Also, in StartAsync the cancellationToken is not passed:

    _host.StartAsync(cancellationToken);

compile error

I created a new WPF (.net core 3) project, and put the codes in MainWindow.xaml.cs. I'm getting an error:
host = new HostBuilder()
.ConfigureServices(services =>
{
services.AddStandaloneGrpcServer(o => //this line generated the error
{
// Change the port
o.ListenLocalhost(5007);
});
})
.Build();

Error is: CS1061 'IServiceCollection' does not contain a definition for 'AddStandaloneGrpcServer' and no accessible extension method 'AddStandaloneGrpcServer' accepting a first argument of type 'IServiceCollection' could be found (are you missing a using directive or an assembly reference?)

I've added the nuget package grpc.aspnetcore.server version=2.25.0
please advice on what I did wrong.. thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.