WCF Rest 服务和 protobuf-net
WCF Rest service and protobuf-net
我关注了这个link。
[https://www.drdobbs.com/windows/working-with-protobuf-wcf-services/240159282][1]
这个link基本上展示了如何使用带有WCF服务的protobuf-net进行序列化。我的要求是将 WCF rest 与 WebGet 和 WebInvoke 选项一起使用。它不适用于此,我总是在 xml 序列化而不是 protobuf 的客户端获取数据。然后我去了这里和其他声称可以使用 WCF + Protobuf 但没有 WCF rest 的无数 links。
有关于为 protobuf 开发自己的 mediaformator 的信息,但该界面在 WCF 预览版 (2011) 中,从未进入我正在使用的 .net 4.6。
我是否遗漏了一些明显的东西,或者 protobuf 根本无法与 WCF rest 一起使用?
谢谢
周杰伦
(就直接在protobuf-net库中的内容而言)
我没有专门针对 WCF REST。在序列化级别它应该工作正常,但我不知道需要什么才能将它挂接到那里的任何特定框架/实现。这不是我要求的场景。
目前,gRPC 似乎比 WCF 更受欢迎,因此我们对 gRPC 有完整的支持。
如果我可以做些什么来启用 WCF REST,那很好 - 但这不是我研究过的主题。
所以基于这里的答案 WCF protobuf endpoint 400 bad request, I could make Protobuf-net working but with a separate endpoint. It also has an issue with uri template for parameters. And also content negotiation is not possible this way as I can't change response type based on the client's accept header. After that I had a look at https://github.com/protobuf-net/protobuf-net/blob/main/src/protobuf-net/ServiceModel/ProtoEndpointBehavior.cs 并且可以看到它也将默认的数据合同序列化器与原始序列化器进行了交换。看起来多个序列化程序不能存在于同一个端点上以这种方式进行内容协商。
我关注了这个link。
[https://www.drdobbs.com/windows/working-with-protobuf-wcf-services/240159282][1]
这个link基本上展示了如何使用带有WCF服务的protobuf-net进行序列化。我的要求是将 WCF rest 与 WebGet 和 WebInvoke 选项一起使用。它不适用于此,我总是在 xml 序列化而不是 protobuf 的客户端获取数据。然后我去了这里和其他声称可以使用 WCF + Protobuf 但没有 WCF rest 的无数 links。
有关于为 protobuf 开发自己的 mediaformator 的信息,但该界面在 WCF 预览版 (2011) 中,从未进入我正在使用的 .net 4.6。
我是否遗漏了一些明显的东西,或者 protobuf 根本无法与 WCF rest 一起使用?
谢谢 周杰伦
(就直接在protobuf-net库中的内容而言)
我没有专门针对 WCF REST。在序列化级别它应该工作正常,但我不知道需要什么才能将它挂接到那里的任何特定框架/实现。这不是我要求的场景。
目前,gRPC 似乎比 WCF 更受欢迎,因此我们对 gRPC 有完整的支持。
如果我可以做些什么来启用 WCF REST,那很好 - 但这不是我研究过的主题。
所以基于这里的答案 WCF protobuf endpoint 400 bad request, I could make Protobuf-net working but with a separate endpoint. It also has an issue with uri template for parameters. And also content negotiation is not possible this way as I can't change response type based on the client's accept header. After that I had a look at https://github.com/protobuf-net/protobuf-net/blob/main/src/protobuf-net/ServiceModel/ProtoEndpointBehavior.cs 并且可以看到它也将默认的数据合同序列化器与原始序列化器进行了交换。看起来多个序列化程序不能存在于同一个端点上以这种方式进行内容协商。