M
M
Morrowind2022-04-07 15:52:29
C++ / C#
Morrowind, 2022-04-07 15:52:29

How to get the environment variables set on the host, in a WorkerService program?

Hey!
The problem is this. I am writing a WorkerService program. On my computer, the software in the debug and in the release and in the deployment sees all the installed environment variables.
When deployed to a remote Windows Server, the software no longer sees these variables.
I created a simple program with default reading of the necessary variables and writing to the log. The log is empty.

Question: Do I need to somehow explicitly call something at the start of the software so that it pulls up all the global variables from the machine? Or is the problem probably somewhere in the north? (Alas, there is no direct access there).

The code of the software itself:
624ede4bb01cc151430410.png
624ede5249548729383052.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sergey, 2022-04-08
@hekkaaa

Judging by the code snippet,
you compared the service
under which user it works in each case?
in addition, there are several environments:
MACHINE, PROCESS, USER
https://docs.microsoft.com/ru-ru/dotnet/api/system...
https://docs.microsoft.com/ru-ru/dotnet /api/system...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question