Description
As reported before in (#52416, #50020), asp.net fails the IsWindowsService() check on Windows Server Core and in Docker containers. This breaks all asp.net services on these platforms, requiring brittle workarounds.
This issue was fixed in #62452 but unfortunately, the fix (36bf84f) was not back ported to existing dotnet versions, including 6.0 despite being an LTS release that's supposed to be supported for over two more years.
Reproduction Steps
Create an ASP.Net Windows Service and run it in a Docker container.
Check IsWindowsService()
Expected behavior
IsWindowsService() should return true when running as a service
Actual behavior
IsWindowsService() returns false, causing .UseWindowsService() to not configure the app properly.
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response