我映射了一个网络驱动器(192.168.0.6/e$),暂且定义其命名为Z:\\,
我通过winfrom程序就能很容易的找到这个映射的地址(Directory.Exists("Z:\\")=true),但我写了一个Windows服务之后,通过服务用同样的方法就怎么也找不到这个映射路径,请问这是为什么?

解决方案 »

  1.   

    Your service normally runs under "Local System" account. It has different profile from a logged on user's profile.
    So the network shared created by the user has no meaning to your service.
      

  2.   

    那谁知道遇到这样的问题该怎么解决吗1, don't use network share in your service.
       bool b = System.IO.Directory.Exists(@"\\192.168.0.6\e$");2, your service creates the network share by WMI or using NetShareAdd() API.
      

  3.   

    服务用current user设置不行么?