C# File.Move 防火墙端口

C# File.Move firewall port

我需要复制 and/or 跨服务器移动文件到我的另一端 防火墙。我想知道是否有人可以告诉我我需要哪些端口 在我的 C# 程序中打开 运行 这些方法?

class MoveIt
{
    public static void Main()
    {
        var localPath = @"c:\temp\";
        var remotePath = @"\MyRemoteServer\MyShare\MyPath\"

        try
        {
            if (File.Exists(localPath + "MyTestFile.txt") &&
                Directory.Exists(remotePath))
            {
                File.Move(localPath + "MyTestFile.txt", remotePath + 
                "MyTestFile.txt");
            }
        }
        catch (Exception e)
        {
            Console.WriteLine("The process failed: {0}", e.ToString());
        }
    }
}

您至少需要 TCP 445,并且确定您还需要 TCP 137-139,尽管后一组只是如果您仍然坚持使用 NetBIOS 进行 smb 名称解析。