We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add interface ,Set the default value of the ServerCallContext parameter to null. see code
using Greet; using Grpc.Core; using Surging.Core.CPlatform.Ioc; using Surging.Core.CPlatform.Runtime.Server.Implementation.ServiceDiscovery.Attributes; using System.Threading.Tasks; namespace Surging.IModuleServices.Common { [ServiceBundle("api/{Service}/{Method}")] public interface IGreeterService : IServiceKey { Task<HelloReply> SayHello(HelloRequest request, ServerCallContext context=null); } }
add GreeterBehavior, see code
using Greet; using Surging.Core.CPlatform.Ioc; namespace Surging.Modules.Common.GreeterServices { public partial class GreeterBehavior : Greeter.GreeterBase,IServiceBehavior { } }
Add business module,see code
using Greet; using Grpc.Core; using Surging.IModuleServices.Common; using Surging.Modules.Common.GreeterServices; using System.Threading.Tasks; namespace Surging.Modules.Common.Domain { public class GreeterService: GreeterBehavior, IGreeterService { public override Task<HelloReply> SayHello(HelloRequest request, ServerCallContext context) { return Task.FromResult(new HelloReply { Message = "Hello " + request.Name }); } } }
test rest call test grpc call
The text was updated successfully, but these errors were encountered:
client grpc test code:
using Greet; using Grpc.Core; using System; namespace GrpcService1 { public class Program { public static void Main(string[] args) { var channel = new Channel("127.0.0.1", 95, ChannelCredentials.Insecure); var client = new Greeter.GreeterClient(channel); var result = client.SayHello(new HelloRequest { Name = "fanly" }); Console.WriteLine("grpc Client Call SayHello():" + result); Console.ReadKey(); } } }
Sorry, something went wrong.
No branches or pull requests
add interface ,Set the default value of the ServerCallContext parameter to null. see code
add GreeterBehavior, see code
Add business module,see code
test rest call
test grpc call
The text was updated successfully, but these errors were encountered: