我有一个使用protobuf-net.gRPC的gRPC服务器,它使用.NET Core3.1。它使用HTTP框架和ASP.NET幕后运行HTTP。我注意到,第一次访问此服务器上的gRPC端点时,与同一端点上的后续调用相比,它们在ASP中间件上花费的时间要多得多。 Time taken from
Microsoft.AspNetCore.Routing.EndpointMiddleware[ExecutedEndPoint] : Executing endpoint 'gRPC - /grpc.....'
Until hitting the actual endpoint
我在dotnet asp net 6中使用了类似的内容:
<PackageReference Include="protobuf-net.Grpc.AspNetCore" Version="1.0.152" />
<PackageReference Include="protobuf-net.Grpc.AspNetCore.Reflection" Version="1.0.152" />
[DataContract]
public class TaskItem
{
//other propert
我在使用GRPC方面是全新的。我有关于设置.proto文件的问题。在我现有的解决方案中,我以这个类为例:
public class Car
{
public int Id { get; set; }
public string Brand { get; set; }
public string? Type {get; set;}
}
Car类被放置在核心项目中,因为它被解决方案周围的其他逻辑所使用。但是,如果我想返回我的GRPC,是否真的有必要再次在.proto文件中定义它-- ala --如下:
message CarReply {
int32 Id =
我们正在将现有的REST服务转换为gRPC核心。迁移现有类时,要了解gRPC没有十进制数据类型。我们在C#中有一个类,定义为
public class SalarySchedule
{
public decimal Salary { get; set; }
public DateTime? SalaryDate { get; set; }
}
我们在proto文件中实现了这一点,如
message SalarySchedule
{
// TODO: How to define this double to decimal
double Salary = 1;
我正在将一个项目从gRPC C#升级到gRPC for .NET。
我试图将一个对象传递给我的服务,以便在调用gRPC服务时采取行动。以前在gRPC C#中,它非常简单,看起来如下所示:
public class FooService : FooService.FooServiceBase
{
private readonly ICustomObject _custom;
public FooService(ICustomObject custom)
{
_custom = custom;
}
// action defined in my proto fi
我的grpc服务器是在VC++中,传输1千兆点(1e9)的数据-其中每个点是1、2、4或8字节的数据,具体取决于所选的精度。我有03个客户机--每种语言都有一个-- Cpp-14、Python-3.9和C# (.net 5.0)。C++使用grpc vc包,Python使用pip包,C#使用nuget包。我的电脑有10G的以太网卡。 在单线程中-应用程序的最大速度为Cpp: 4.5Gbps,C#:2.5Gbps,Python: 9Gbps。为什么python比C++快2倍,比C#快近4倍? 下面是我的代码(仅限主要摘录): Proto文件: service data {
rpc get
我在本地模式下从估计器中部署了一个模型,当试图使用gRPC调用Tensorflow服务(TFS)预测端点时,我得到了以下错误:
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
status = StatusCode.UNAVAILABLE
details = "failed to connect to all addresses"
我正在执行gRPC请求,就像在这个中一样
import grpc from tensorflow.compat.v1
impor
我有一个grpc服务。我正在开发一台mac,西拉。当对本地服务运行grpc客户端时,一切正常,但是当对码头容器中的相同服务运行同一个客户端时,我会得到以下错误:
transport: http2Client.notifyError got notified that the client transport was broken EOF.
FATA[0000] rpc error: code = Internal desc = transport is closing
这是我的码头文件:
FROM golang:1.7.5
RUN mkdir -p /go/src/github.com/fo