防火墙阻止在我的 filezilla 服务器中上传文件

Firewall blocking uploading a file in my filezilla server

我正在尝试设置 filezilla 服务器。我已按照 here 的说明进行操作。我写了一个简单的 c# 脚本来将数据上传到服务器。我的代码如下:

static void UploadFile(string filepath)
{
    string m_FtpHost = "ftp://ip:port/";
    string m_FtpUsername = "user";
    string m_FtpPassword = "pass";

    // Get an instance of WebClient
    WebClient client = new System.Net.WebClient();
    // parse the ftp host and file into a uri path for the upload
    Uri uri = new Uri(m_FtpHost + new FileInfo(filepath).Name);
    // set the username and password for the FTP server
    client.Credentials = new System.Net.NetworkCredential(m_FtpUsername, m_FtpPassword);
    // upload the file asynchronously, non-blocking.

    client.UploadFileAsync(uri, "STOR", filepath);
}

当我运行从同一台计算机上运行该脚本时,一切正常。当我尝试从同一 lan 的另一台计算机 运行 相同的脚本时,我遇到了问题。该文件没有正确发送。但是,当我关闭防火墙时,上传正常进行。知道如何越过防火墙吗?

通常 Windows 会在程序尝试使用任何端口时要求用户授予该程序权限(Windows 会弹出一个询问允许或禁止该程序使用该端口的窗口) ... 我不确定该怎么做,但我找到了 link ...

I'm not sure what conditions need to be met to expose this dialog, I would assume an application that attempts to open a listening port on a vanilla Windows instance should always display this dialog. Why don't you try adding your application to the 'authorized applications' list, or opening the port manually using the Windows Firewall COM interop (NetFwTypeLib)?

http://blogs.msdn.com/b/securitytools/archive/2009/08/21/automating-windows-firewall-settings-with-c.aspx

引自 alexw