C# 拒绝访问路径192.168.1.XX的Windows服务

C# 拒绝访问路径192.168.1.XX的Windows服务,c#,asp.net,permissions,windows-services,authorization,C#,Asp.net,Permissions,Windows Services,Authorization,我的windows服务从同一网络中的另一台电脑复制文件 这是密码 string fileName = "test.txt"; string sourcePath = @"\\192.168.1.XX\Users\utente\Desktop\prova\"; string targetPath = @"C:\Users\IDEA\source\repos\BotterService\bin\Debug"; string sourceFile = System.IO.Path.Combine(

我的windows服务从同一网络中的另一台电脑复制文件

这是密码

string fileName = "test.txt"; 
string sourcePath = @"\\192.168.1.XX\Users\utente\Desktop\prova\";
string targetPath = @"C:\Users\IDEA\source\repos\BotterService\bin\Debug";

string sourceFile = System.IO.Path.Combine(sourcePath, fileName);
string destFile = System.IO.Path.Combine(targetPath, fileName);
System.IO.Directory.CreateDirectory(targetPath);
try
{
    File.Copy(sourceFile, destFile);
}
catch (Exception ex)
{
    Debug("EXCEPTION: " + ex.Message);
}
在我的电脑上,我有读写
test.txt
文件的所有权限。事实上,我可以读、写和保存这个文件

我的错误权限被拒绝
192.168.1.XX\Users\utete\Desktop\prova\

谢谢

您是使用您的帐户还是其他帐户运行服务?请使用文件资源管理器浏览文件,然后使用资源管理器打开。然后使用资源管理器进行复制。这将检查凭据以确保您有权访问所有文件夹和文件。您必须确保在尝试使用相同的代码之前手动工作。@jdweng OP在我的电脑上说我有读写的所有权限,所以他们已经这样做了。那么您在服务的设置中输入了用户名和密码?@jdweng使用文件资源管理器打开并写入此文件