Accessing shared folder over a network in windows service

六月ゝ 毕业季﹏ 提交于 2019-12-02 04:17:25

问题


I have a windows service that needs to access the files (sometime modification also) from a network (shared folder). I get the file name from an XML like,

<add key ="FolderName" value="\\192.168.0.1\Source" />

I made a log file which always shows that the path is not found.

Also i need to know how to debug a windows service using visual studio?

Thanks in advance.


回答1:


Most likely, the problem is in permissions to the shared folder. Your service runs under some user account and this account needs to have access granted to that folder. In case it's the 'Local Service' account you won't be able to access it. Just check under what account you run the service and whether it has access to that folder.

UPDATE: See this MSDN article for how to debug windows service applications.



来源:https://stackoverflow.com/questions/6016388/accessing-shared-folder-over-a-network-in-windows-service

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!