Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

131
Visualizações
.Net 6 no ejecuta más de dos HostedServices

Después de actualizar a .Net 6, mi servicio alojado tiene problemas para tener más de dos servicios alojados registrados:

 System.InvalidOperationException HResult=0x80131509 Message=Server has already started. Source=Microsoft.AspNetCore.Server.Kestrel.Core StackTrace: at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.<StartAsync>d__29`1.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult() at Microsoft.AspNetCore.Hosting.GenericWebHostService.<StartAsync>d__34.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult() at Microsoft.Extensions.Hosting.Internal.Host.<StartAsync>d__11.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult() at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.<RunAsync>d__4.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.<RunAsync>d__4.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult() at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host) at Test.Program.Main(String[] args)

Puede reproducirlo creando una nueva aplicación de servidor Blazor y simplemente agregar tres servicios de fondo vacíos como este:

 public class TestService1 : Microsoft.Extensions.Hosting.BackgroundService { protected override async Task ExecuteAsync(CancellationToken stoppingToken) { } }

A medida que agrego más de dos servicios alojados en la clase de inicio, el inicio de la aplicación se bloquea con la excepción anterior.

 services.AddHostedService<TestService1>();

¿Alguien tiene una idea de lo que está mal? Estoy ejecutando .Net 6 Preview 5.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Después de investigar un poco más, encontré este hilo: https://github.com/dotnet/core/blob/main/release-notes/6.0/known-issues.md#net-runtime Puede usar la siguiente solución hasta que Microsoft soluciona este problema en la próxima vista previa de .Net

 Host.CreateDefaultBuilder(args) .UseDefaultServiceProvider(o => { o.ValidateOnBuild = false; });
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda