尝试使用来自Web作业的UNC路径访问共享的网络驱动器时,出现“拒绝访问”错误。 我试图从客户端服务器上的共享文件夹和SFTP中读取文件。 从本地访问所有文件都可以正常工作。但是从天蓝色的Web作业中获取对文件夹的拒绝访问错误。 这是我的代码:
var con = new ConnectionInfo(host, 22, username, methods.ToArray());
using (var client = new SftpClient(con))
{
Console.WriteLine("Connecting to client");
client.Connect();
Console.WriteLine("Connected to client");
Console.WriteLine("Getting file from Azure ");
string tstkey1 = File.ReadAllText(@"\\{shared folder}\test\test.txt");
Console.WriteLine("Connected");
string tstkey = File.ReadAllText(@"\\{shared folder}\test\test.txt");
Console.WriteLine(tstkey);
byte[] fileContents = Encoding.UTF8.GetBytes(tstkey);
Stream requestStream = new MemoryStream(fileContents);
Console.WriteLine(requestStream);
Console.WriteLine("Uploading to FILE to client SFTP");
client.UploadFile(requestStream, "/inbound/STEIN366_ACH_1/*.*" + "Test");
client.Disconnect();
Console.WriteLine("Deleting File");
File.Delete(@"\\{folder}\test\test.txt");
Console.WriteLine("Dissconnected from client");
}
有人可以帮助我,如何从Azure连接到共享文件夹! 提前致谢。