dotnet-architecture / grpc-for-wcf-developers Goto Github PK
View Code? Open in Web Editor NEWgRPC for WCF Developers guidance samples
gRPC for WCF Developers guidance samples
In the FullStockTickerService example that uses bidirectional streaming it feels to me like the use of the AwaitCancellation()
method that creates a task that completes when the CancellationToken
of the ServerCallContext
is cancelled is unneccesary and has just been caried over from the example with the single stream without much thought.
Why not just await the HandleActions()
method directly there since its task also completes when the same CancellationToken
is cancelled?
Furthermore, if an exception is thrown in the HandleActions()
method for some reason in a more complex example it will not cancel the CancellationToken
and the program will stop reading new actions but the program will not stop because it will continue waiting for the token to be cancelled at the call to AwaitCancellation()
. This seems rather dangerous to me in a real world scenario.
Grpc.Core.RpcException: Status(StatusCode=Internal, Detail="Error starting gRPC call. HttpRequestException: The SSL connection could not be established, see inner exception. IOException: The handshake failed due to an unexpected packet format.")
at TraderSys.Portfolios.ClientConsole.Program.Main() in
The server is up
The sample could be more approachable if you remove the Authorize attribute from PortfolioService.cs
I get this exception when I run the sample:
at Grpc.Net.Client.Internal.GrpcCall`2.ValidateHeaders()
at Grpc.Net.Client.Internal.GrpcCall`2.<SendAsync>d__76.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
at Grpc.Net.Client.Internal.GrpcCall`2.<GetResponseHeadersAsync>d__67.MoveNext()
And the output clued me in that authorization is expected:
System.InvalidOperationException: Endpoint gRPC - /PortfolioService.Portfolios/Get contains authorization metadata, but a middleware was not found that supports authorization.
Configure your application startup by adding app.UseAuthorization() inside the call to Configure(..) in the application startup code. The call to app.UseAuthorization() must appear between app.UseRouting() and app.UseEndpoints(...).
at Microsoft.AspNetCore.Routing.EndpointMiddleware.ThrowMissingAuthMiddlewareException(Endpoint endpoint)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
Few questions about the statement "Migrate a WCF solution to gRPC":
Add all nuget package versions to it. Might need one per sample/solution but better if can have just one.
Set TargetFramework in it as well, or else also add a Directory.Build.props file with that.
I tried to host the WCF service in the tradersys on IIS version 10 on Windows 10, which throws an exception:
The AutofacServiceHost.Container static property must be set before services can be instantiated. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: The AutofacServiceHost.Container static property must be set before services can be instantiated.
I'm aware of this issue as discussed several times on stackoverflow, such as this post. Yet the code by Microsft contains the appropriate autofac container.
While it works just fine using the Visual Studio and IISExpress.
Did I miss anything on deploying this as a service?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.