.NET Core 5 RawRabbit Serializzatore/Dependency Injection Problema

0

Domanda

Ho microservice base .NET Core 2.2. Sto usando RawRabbit (versione 2.0.0-beta9) come il bus di servizio. I seguenti pacchetti sono stati installati:

<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" />

Questo è ciò che il mio controller si presenta come:

 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}");
}

Il problema si verifica quando il codice tenta di effettuare le seguenti operazioni:

await _busClient.PublishAsync(model);

L'eccezione che ottengo è:

Metodo non trovato: Void Newtonsoft.Json.JsonSerializer.set_TypeNameAssemblyFormat(System.Runtime.Serialization.Formatters.FormatterAssemblyStyle)'.

1

Migliore risposta

0

Sembra che non è legato al tuo broker di messaggi o pubblicare (dal modo in cui potrebbe essere meglio, se hai menzionato se il messaggio è stato ricevuto dal consumatore o non) Ma sembra che da qualche parte si utilizza TypeNameAssemblyFormat in newton JSON che è ormai obsoleta secondo qui.

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

Si dovrebbe usare TypeNameAssemblyFormatHandling. Vedi anche qui

2021-11-29 20:34:02

In altre lingue

Questa pagina è in altre lingue

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