My Windows Service is trying to access a local share via its UNC path on its startup.
It has full permissions and path exists, I can tell that since when starting my service long after boot, everything works.
However, on boot time I'm getting errors
System.UnauthorizedAccessException: Access to the path '\\MyPc\Share' is denied.
I've added a retry mechanism, and it works if I retry without limitations, but that's bad design and could lead to covering up actual errors.
My service is configured to depend on LanmanServer
(svchost.exe
) when installed, but I'm not sure if that is the service that is responsible for setting up the network share on boot. Couldn't find documentation as to which service or other component is. Could also be that I misconfigured the dependency. From my wixproj
:
<ServiceInstall Id="MyServiceId"
Name="MyService"
DisplayName="My Service"
Description="The service which is mine"
Start="auto"
Type="ownProcess"
ErrorControl="ignore"
Vital="no" >
<util:ServiceConfig FirstFailureActionType="restart"
SecondFailureActionType="restart"
ThirdFailureActionType="restart"
RestartServiceDelayInSeconds="60"
ResetPeriodInDays="49710"/>
<ServiceDependency Id="LanmanServer"/> <!-- svchost.exe (netsvcs) -->
</ServiceInstall>