fogbit
fogbit

Reputation: 2063

Windows service fails to read UNC-path at Windows startup

I have a windows service, which runs on windows startup. When loading, the service reads (OpenFile) an unc-path. The unc-path physically leads to a local path, locating on the same PC. The path looks like "\\COMPUTER_NAME\xxx". Sometimes (!) the service fails to read the path, OpenFile returns error code 53 (ERROR_BAD_NETPATH). If I restart the service later manually, everything works fine. The UNC-path access right is full permission (Everyone, FULL).

I suspect that the error happens because the service starts earlier than some windows system services providing possibility for working with UNC.

I set up the server dependencies on LanmanServer and LanmanWorkstation, after than the error happen more rarely. Then I added dependencies on NetBIOS and NetBT - no errors yet.

The problem is that I can't find the full list of services my services has to depend on. Are the mentioned ones enough for working with UNC? Do i have to add DNS(WINS) or something else?

Thank you.

Upvotes: 0

Views: 546

Answers (1)

Rita Han
Rita Han

Reputation: 9700

Try delayed start to see if it helps. A delayed-start service is started after other auto-start services are started plus a short delay.

enter image description here

Refer to SERVICE_DELAYED_AUTO_START_INFO.

Upvotes: 1

Related Questions