Windows服务仅在引导时无法通过UNC路径访问本地共享

时间:2018-01-29 08:00:27

标签: wix windows-services windows-installer unc windows-share

我的Windows服务正在尝试通过其启动时的UNC路径访问本地共享。

它有完整的权限和路径存在,我可以说,因为在启动后很长时间启动我的服务,一切正常。

然而,在开机时我遇到错误

System.UnauthorizedAccessException: Access to the path '\\MyPc\Share' is denied.

我添加了一个重试机制,如果我在没有限制的情况下重试,它会起作用,但这样做很糟糕,可能会导致实际错误。

我的服务配置为在安装时依赖LanmanServersvchost.exe),但我不确定这是否是负责在启动时设置网络共享的服务。无法找到有关哪个服务或其他组件的文档。也可能是我错误配置了依赖项。来自我的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>

0 个答案:

没有答案
相关问题