【问题标题】:Windows Service not able to access a file in VB.net in Windows 2003 ServerWindows 服务无法访问 Windows 2003 Server 中 VB.net 中的文件
【发布时间】:2010-03-12 12:57:57
【问题描述】:

我有一个用 VB.net 开发的 .net Windows 服务。我在根目录中有一个名为 Connections.XML 的设置文件,我将基目录设置如下

    System.IO.Directory.SetCurrentDirectory(System.AppDomain.CurrentDomain.BaseDirectory)

 Dim _path As String = System.AppDomain.CurrentDomain.BaseDirectory()
                        Dim file As String = Path.Combine(_path, "Connections.xml")

当我安排服务时,这在我的 Windows XP 机器上运行得非常好。但是当我在我们的开发服务器(Windows 2003 64 位服务器)中安装相同的服务时,由于某种原因它无法找到这个文件。

我有什么遗漏吗?感谢您能帮我解决这个问题。

谢谢,祝你愉快。

【问题讨论】:

  • 您收到的错误信息是什么?您是否在服务中启用了任何日志记录?

标签: windows vb.net web-services


【解决方案1】:

运行服务的用户帐户是否对文件及其路径具有适当的访问权限?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-04-22
    • 2012-12-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多