C
C#12mo ago
dotnet123123

❔ .NET background service - use windows OS level proxy

So, I have a background service written in C#/.NET running on windows 10 & 11. It does periodic http requests using the standard HttpClient. The issue is that I need the HttpClient to use the Windows OS system wide proxy settings for the http requests. The issue is that as far as I can tell, the proxy settings can only be programmatically retrieved in the Registry under the "Current User" area. This can not be retrieved on the windows service because it runs under a different user than who is logged in. Setting the proxy value in "Settings" GUI app, or using netsh winhttp set proxy, my background service http client traffic doesn't get routed through the proxy. Any help would be greatly appreciated. EDIT : stated another way. From a background service, how can I read the windows proxy settings successfully?
4 Replies
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
dotnet123123
dotnet12312312mo ago
lol. one would think it would be a very trivial thing to query the system wide proxy settings and use them. But, alas, windows has other ideas
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
Accord
Accord12mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.