我已成功部署Windows 7计算机上的C#Windows服务。C#Windows服务尝试写入文件夹时访问被拒绝
现在,当我尝试创建使用该代码的文件:
FileStream os = new FileStream(String.Format(folderName, fileName), FileMode.Create);
我可以访问的文件路径被拒绝。
在服务安装程序我设置以下参数:
this.serviceProcessInstaller1.Account =
System.ServiceProcess.ServiceAccount.LocalSystem;
this.serviceProcessInstaller1.Password = "Pass";
this.serviceProcessInstaller1.Username = "Administrator"
我添加了所有可能的账户,具有完全权限的文件夹,我想创建该文件,但没有任何帮助。
任何建议,你在错误的道路使用String.Format()
高度赞赏
您是否在管理工具下的“服务”对话框中确认了服务所使用的用户帐户? – 2010-06-07 16:28:07