Questions tagged [worker-service]
66 questions
8
votes
3 answers
.Net Core Worker Service appsettings.json not being read
I created a .net core worker service, had IConfiguration injected into it so I can read a property from appsettings.json but everytime I run the file the property comes up as null. However if I force the IConfiguration to add a json file via the…

guimar86
- 81
- 1
- 1
- 4
5
votes
2 answers
Grpc.Core.RpcException: 'Status (StatusCode = "Unavailable", Detail = "Error starting gRPC call
I'll be immensly grateful if you'd tell me what's causing the problem and how to fix it.
P.S. Sorry for posting all the code, it's just I'm not sure which exact part is relevant to the problem.
Here's the full text of…

Борис Яницкий
- 129
- 1
- 2
- 7
4
votes
1 answer
Connection strings in .NET 6 Worker service
I am trying to connect to database with connection string which is written in appsetting.json. I try to pass it in UseSqlServer("...") in AddDbContext but it just doesn't work. When I write it in Context class it works.
So, program runs without…

forrestDumb
- 57
- 1
- 7
3
votes
0 answers
What is the recommended approach to collect and send metrics to Prometheus for .Net Core Worker Service?
I have a .net core worker service which will run in the background. I would like to capture metrics about the health status of the service and it needs to be consumed by Prometheus.
What is the recommended approach whether we need to use default…

Victor
- 31
- 3
2
votes
0 answers
Why background service is not working as a service but works as an executable?
I have created a background service in C#. Last week I moved it to my virtual machine, I created a service as sc.exe create NameOfService binPath= blabla and worked perfectly until Sunday (yesterday 2/13/2023 11:58 PM). Today when I checked the…

Paul Viorel
- 234
- 1
- 11
2
votes
4 answers
How to run 10 long-running functions repeatedly at specific times, avoiding overlapping execution?
I am creating a .NET core worker service that is intended to run 10 different long running functions which parse various CSV files and spreadsheets.
I need each function to run at various times daily based on the specific function. If the very same…

chrisg229
- 909
- 2
- 7
- 21
2
votes
0 answers
Run Worker Service on Mac Os
I have created a Worker Service with .Net 6, I have published it via folder profile for Mac OS, Now in Windows I can create a service using SC CREATE, how do I achieve the same on Mac OS.
I have tried launchd but nothing happens no error or any…

Mehroz Irshad
- 287
- 1
- 5
- 14
2
votes
0 answers
Integration test for .net 6 worker service project
What is a good way of creating integration test for .net 6 worker service project.

Mitiku Teshome
- 21
- 2
2
votes
2 answers
How to integrate Sentry with .NET 6.0 Worker Service?
I integrated Sentry with .NET Core 6.0 Worker Service this way:
NuGet: Sentry 3.17.1
// Program.cs:
using Sentry;
var sentryDsn = Environment.GetEnvironmentVariable("SENTRY_DSN");
using (SentrySdk.Init(o =>
{
o.Dsn = sentryDsn;
o.Debug =…

adamsfamily
- 1,746
- 19
- 37
2
votes
1 answer
Why doesn’t IHostBuilder find the ConfigureWebHostDefaults method working with the Visual Studio’s Worker Service template?
I created a .NET 5, Visual Studio project using the Worker Service template, which creates a Program.cs file containing the Program class with the following method:
public static IHostBuilder CreateHostBuilder(string[] args) =>
…

Pine Code
- 2,466
- 3
- 18
- 43
1
vote
2 answers
How to add a list of specific object in a configuration file for a WorkerService
As far as what I understand:
WorkerService is the new way to define a Windows Service (app that run as as service).
By default, using the contextual menu on the project, the type of configuration file associated to a WorkerService is stil a xaml…

Eric Ouellet
- 10,996
- 11
- 84
- 119
1
vote
1 answer
Possible risks of lowering 'limit_request' in Odoo 11 due to high memory usage?
I'm using Odoo 11 and have properly configured my server with thoses values:
limit_memory_hard = 20132659200
limit_memory_soft = 16777216000
limit_request = 8192
limit_time_cpu = 3600
limit_time_real = 600
limit_time_real_cron =…

PeiKobayashi
- 21
- 2
1
vote
1 answer
Cannot find AddRefitClient method for Worker Service
Currently I using .NET version 7 to do background job service. I add Worker Service project, in Program.cs file I cannot call method AddRefitClient although I add package Refit to call API. I don't want to use HttpClient
This is error…

Truc
- 386
- 4
- 12
1
vote
2 answers
.NET 6 Is it possible to scan the background services and invoke AddHostedService dynamically without adding them one by one
I am now using .NET 6 Worker Service to develop an backend service, and I have multi background services need to be registered by AddHostedService<> like:
var host = Host.CreateDefaultBuilder(args)
.ConfigureServices(services =>
{
…

Ocean Sun
- 81
- 6
1
vote
1 answer
How to configure HealthCheck with IHost?
In our current implementation of healthcheck's in worker service we do like this (simplified)
var options = new WebApplicationOptions {
Args = args,
ContentRootPath = WindowsServiceHelpers.IsWindowsService()
?…

Henrik Fransas
- 1,067
- 1
- 10
- 16