which Windows service ensures network connectivity?

12,311

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.

Share:
12,311

Related videos on Youtube

Lluís
Author by

Lluís

Updated on November 03, 2022

Comments

  • Lluís
    Lluís over 1 year

    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
      vcsjones about 12 years
      Your 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
      Lluís about 12 years
      then, I guess I should retry the connection until it's successful
  • usr
    usr about 12 years
    This is a good heuristic. In any case, you need to do retry logic I guess?
  • user957902
    user957902 about 12 years
    We 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
    Lluís about 12 years
    thanks! now service starts correctly on boot, although I'll should add the retry logic too.
  • Darxis
    Darxis about 4 years
    Unfortunately this method does not work in Windows Server 2019 :/
  • Joseph Willcoxson
    Joseph Willcoxson over 2 years
    @Darxis So did you find a solution for Server 2019?
  • Darxis
    Darxis over 2 years
    @JosephWillcoxson I resolved my issue but not using service dependencies, see my answer stackoverflow.com/a/70632661/699850