asp.net-core-hosted-services Questions

3

Solved

I have a .NET Generic Host with an IHostedService that receives events from an OPC-UA interface and that process them. The problem is that if an unhandled exception occurs during the processing of...

4

Solved

What is the proper way to register a custom hosted service in ASP.NET Core 2.1? For example, I have a custom hosted service derived from BackgroundService named MyHostedService. How should I regist...

3

I'm working with the HostBuilder in .NET Core (not the WebHost !). I have one Hosted Service running in my application that overrides the ExecuteAsync/StopAsync methods of the background Service an...
Grefer asked 18/6, 2019 at 8:17

2

Solved

I have a BackgroundService hosted in .net generic host as follows: var builder = Host.CreateDefaultBuilder(args); builder .ConfigureLogging((hostingContext, logging) => { logging.ClearProvi...

5

Solved

I have an application that normally should be a simple console application to be programmed as a scheduled task from time to time called by the windows task scheduler. The program should launch som...

6

Solved

I have an .NET Core 3.1 app that serves an endpoint that describes health of application, and an IHostedService crunching through data in database. There's a problem though, the worker function of ...
Nesbitt asked 18/5, 2020 at 9:19

2

Solved

I'm trying to write a simple web api project with a background service executing a method every second. This method loops over a list and just prints out (for the moment) some statistics. I declare...

2

Solved

I'm implementing simple background job queue in Asp Net Core app. I've created BackgroundJobQueue which uses BoundedChannel<T> under the hood to enqueue items that will be processed via Hoste...
Elonore asked 1/8, 2021 at 16:55

4

Solved

I have .NET Core web API project, for some reasons, we created a background service in this project and start running the background service while the application is started. So, we created a Backg...
Kraal asked 21/1, 2022 at 4:19

2

I have an API which contains a HostedService that is built in VS2022 with .Net 6. When I run locally the service is called as expected and everything works fine but when deplyed, the service doesn'...
Osmious asked 27/4, 2022 at 19:2

2

Solved

How does a Azure function differ from a ASP.NET Core Worker Service? Does both of these cover the same use cases? How do I decide which one to use?
Koehn asked 12/12, 2019 at 12:36

2

Solved

I am currently working on a Blazor web assembly project that is core hosted. The project is split up into three parts, Client, Server and Shared. The way I understand it is that when a user hits th...

3

Solved

I have the following simple console application that contains a hosted service: public static async Task Main(string[] args) { using (var host = Host.CreateDefaultBuilder(args) .ConfigureServi...

3

Solved

I have a background task implemented by hosted services in .NET Core. There is very little logic in this class: public class IndexingService : IHostedService, IDisposable { private readonly int i...

2

Solved

Trying to roughly follow MSDN, I've added a hosted service after my scoped services in StartUp class. public void ConfigureServices(IServiceCollection services) { ... services.AddScoped<IUtili...

2

Solved

I am using .NET 5 and I want to run a background task using IHostedService classess as you can see: public class PasargadJobs : IHostedService, IDisposable { private Timer _timer = null!; readonl...

2

Solved

The ASP.NET Core docs for background services show a number of implementation examples. There's an example for starting a service on a timer, though it's synchronous. There's another example which ...
Anthracosilicosis asked 27/3, 2022 at 13:30

5

Solved

In a .Net 5 Web API, I would like to run a background task that sends out bulk emails and SMSes. I know I can create a service that inherits from BackgroundService, and then add it to the DI Contai...

1

Solved

I want to run multiple instances of the same hosted service. I tried registering them twice: services.AddHostedService<MyService>(); services.AddHostedService<MyService>(); But Execute...
Turtleneck asked 12/3, 2021 at 5:54

2

Solved

.net core BackgroundService or IHostedService's start method is async: //IHostedService Task StartAsync(CancellationToken cancellationToken); //BackgroundService Task ExecuteAsync(CancellationToke...
Model asked 10/6, 2019 at 12:59

4

Solved

I am working on a project based on ASP.NET Core 3.1 and I want to add a specific functionality to it to schedule publishing a post in the future in a date and time specified by post author (somethi...

1

Solved

I have a WebAPI that should also receive messages from RabbitMQ. I used this tutorial, because I know that sometimes IIS likes to kill long-running tasks (didn't test it on server yet though, maybe...

1

Solved

I have a requirement that background service should run Process method every day at 0:00 a.m. So, one of my team member wrote the following code: public class MyBackgroundService : IHostedService, ...
Berkelium asked 24/10, 2020 at 19:25

5

Solved

In my MVC .NET core 2.2 app there is HostedService which doing background work. It is register in ConfigureServices method of Startap class services.AddHostedService<Engines.KontolerTimer>(...
Hypervitaminosis asked 16/1, 2019 at 8:31

1

Solved

I have an ASP .NET core Web API which uses Queued background tasks like described here. I've used the code sample provided and added the IBackgroundTaskQueue, BackgroundTaskQueue and QueuedHostedSe...

© 2022 - 2024 — McMap. All rights reserved.