在窗口服务访问共享文件夹在网络上 [英] Accessing shared folder over a network in windows service

查看:271
本文介绍了在窗口服务访问共享文件夹在网络上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个需要从网络(共享文件夹)访问这些文件(有时也修改),一个窗口服务。我从XML得到的文件名一样,

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.

此外,我需要知道如何使用Visual Studio调试Windows服务?

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

在此先感谢。

推荐答案

最有可能的,问题是权限的共享文件夹。您的服务在一些用户帐户运行,该帐户需要有该文件夹授予访问权限。在情况下,它的本地服务帐户,您将无法访问它。只是检查在什么样的帐户运行服务,是否有访问该文件夹。

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.

更新:请参见这个MSDN文章如何调试Windows服务应用程序。

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

这篇关于在窗口服务访问共享文件夹在网络上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆