我遵循这篇文章在我的asp.net核心3.1应用程序中开始使用MessagePack,但由于以下错误消息,它无法工作:
严重性代码描述项目文件行抑制状态错误CS1503参数1:无法从CS1503转换为“MessagePack.MessagePackSerializerOptions”网关C:\Developments\POC\Gateway\Startup.cs 33活动

解决编译问题的另一种选择或解决方案是什么?
发布于 2020-07-07 07:09:58
正如@Michael所说,MessagePackSerializerOptions类型是MessagePackOutputFormatter背后所需要的,而当前的错误发生是因为类型是ContractlessStandardResolver,,这是不一致的。
因此,您只需按以下方式修改代码:
services.AddMvc().AddMvcOptions(option =>
{
option.OutputFormatters.Clear();
option.OutputFormatters.Add(new MessagePackOutputFormatter(ContractlessStandardResolver.Options));
option.InputFormatters.Clear();
option.InputFormatters.Add(new MessagePackInputFormatter(ContractlessStandardResolver.Options));
})
.SetCompatibilityVersion(CompatibilityVersion.Version_2_2);https://stackoverflow.com/questions/62763509
复制相似问题