.NET Core 5 RawRabbit Serializador/Inyección de Dependencia Problema

0

Pregunta

He microservice basado en .NET Core 2.2. Estoy usando RawRabbit (versión 2.0.0-beta9) como el servicio de autobús. Los siguientes paquetes se instala con él:

<PackageReference Include="RawRabbit" Version="2.0.0-beta9" />
<PackageReference Include="RawRabbit.DependencyInjection.ServiceCollection" Version="2.0.0-beta9" />
<PackageReference Include="RawRabbit.Operations.Publish" Version="2.0.0-beta9" />
<PackageReference Include="RawRabbit.Operations.Subscribe" Version="2.0.0-beta9" />

Esto es lo que mi controlador se parece a:

 private readonly IBusClient _busClient;

//...constructor that inits the _busClient

[HttpPost("")]
public async Task<IActionResult> Post([FromBody] CreateActivity model)
{
    model.Id = Guid.NewGuid();
    await _busClient.PublishAsync(model); //Exception thrown here
    return Accepted($"Activities/{model.Name}");
}

El problema se produce cuando el código intenta hacer lo siguiente:

await _busClient.PublishAsync(model);

La excepción lo que me sale es:

Método no encontrado: 'Void Newtonsoft.Json.JsonSerializer.set_TypeNameAssemblyFormat(System.Runtime.Serialization.Formatters.FormatterAssemblyStyle)'.

1

Mejor respuesta

0

Parece que no está relacionada con su broker de mensajes o publicar (por la forma en Que podría ser mejor si usted mencionó si el mensaje fue recibido por el consumidor o no) Pero parece que en algún lugar está utilizando TypeNameAssemblyFormat en newton JSON que es obsoleto en la actualidad de acuerdo aquí.

[ObsoleteAttribute("TypeNameAssemblyFormat is obsolete. Use TypeNameAssemblyFormatHandling instead.")]
public FormatterAssemblyStyle TypeNameAssemblyFormat { get; set; }

Usted debe utilizar TypeNameAssemblyFormatHandling. Ver también aquí

2021-11-29 20:34:02

En otros idiomas

Esta página está en otros idiomas

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Slovenský
..................................................................................................................