简体   繁体   中英

How to use protobuf-net 3 with ASP.NET Core 3.1

I have seen this repository ; it works with a previous version of protobuf, after enabling AllowSynchronousIO , but I don't know how to use it with version 3.

Could you give any hint on using protobuf-net 3 with ASP.NET Core 3.1?

The easiest way is to use protobuf-net.AspNetCore and use AddProtoBufNet , a bit like here . This configures input/output formatters for content negotiation, using the protobuf-net v3 API and "pipelines" (rather than Stream ).

You can use the pipeline APIs directly, but it is a bit more complex than just reading/writing to/from a Stream . Happy to add an example if needed, though.

You need to install protobuf-net.Core by using the below command in the package manager console. You can also install through NuGet package manager.

Install-Package protobuf-net.Core -Version 3.0.29

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM