which Windows service ensures network connectivity?
Solution 1
We have been making our services, that depend on the network begin started, dependent on the "Server" service. Its actual name is "LanmanServer". This has been working ok for us. If you look at its description it states:
Supports file, print, and named-pipe sharing over the network for this computer. If this service is stopped, these functions will be unavailable. If this service is disabled, any services that explicitly depend on it will fail to start.
Our thinking is that if the computer is ready to do thoes functions, then the network has to be started.
Solution 2
I use "Tcpip", "Dhcp", "Dnscache". Works OK for me.
Related videos on Youtube

Lluís
Updated on November 03, 2022Comments
-
Lluís less than a minute
I am doing a windows service that must have network connectivity when it starts. Code is in c# and I set the service dependent from others with
serviceInstaller.ServicesDependedOn = new string[] { "Tcpip" };
I can see dependency correctly entered on windows service manager, but after reboot my service fails to start because it can't connect to network, after host gets an IP the service starts correctly.
I tried with "Tcpip" and "Dhcp" services. Which service should it depend on?
service needs network connectivity since its purpose is to mount a unit through ssh
thanks!
-
vcsjones over 10 yearsYour service should gracefully handle not being connected to the internet. You can't depend on a service to know when you have an actual, valid IP address.
-
Lluís over 10 yearsthen, I guess I should retry the connection until it's successful
-
-
usr over 10 yearsThis is a good heuristic. In any case, you need to do retry logic I guess?
-
user957902 over 10 yearsWe are using WCF services hosted in a windows servicse with protcol net.tcp. Not sure if WCF has any internal retry logic, but is sure throws an exception is you try to open the ServiceHost before the Network has started.
-
Lluís over 10 yearsthanks! now service starts correctly on boot, although I'll should add the retry logic too.
-
Darxis over 2 yearsUnfortunately this method does not work in Windows Server 2019 :/
-
Joseph Willcoxson 10 months@Darxis So did you find a solution for Server 2019?
-
Darxis 10 months@JosephWillcoxson I resolved my issue but not using service dependencies, see my answer stackoverflow.com/a/70632661/699850