开发者

c# windows service - check network folder exists

开发者 https://www.devze.com 2023-03-06 18:39 出处:网络
I have a windows service running as local system开发者_C百科, which will search for some files / folders in specified locations.

I have a windows service running as local system开发者_C百科, which will search for some files / folders in specified locations.

The problem is when i specify the Path to a Shared folder in Network it will return "Path Not Found"

i have set

serviceProcessInstaller1.Account = ServiceAccount.LocalSystem;

but i tried ServiceAccount.NetworkService by setting UserName and Password using this.Context.Parameters[key].ToString()

at this time nothing happens

for ServiceAccount.LocalSystem if i set "Log On" property through "Services.msc" it will work fine. but need it to achieve through code.


You need to run your service under a user account that has rights to the network volumes. Typically this means one of your domain accounts. None of the built in service accounts will have such rights.

0

精彩评论

暂无评论...
验证码 换一张
取 消