Server 2019 Windows Firewall Blocking FTP Traffic With Port 21 and 20 Allowed

Christian Erdtmann 1 Reputation point
2022-02-22T19:19:43.253+00:00

Hey i have a C# written software that try to download files via FTP. On my local machine it works fine. But on the server its blocked by the firewall. With firewall of it works. I allready added port 20 and port 21 to the rules. The Software works with passive mode.

Connection the the FTP works and it read the files and directorys. But by trying to download a file it get timeout.

Any Idea?

Internet Information Services
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,835 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Lex Li (Microsoft) 5,572 Reputation points Microsoft Employee
    2022-02-23T03:21:10.567+00:00

    FTP is an ancient protocol that works badly with firewalls, and merely opening up port 20/21 is far from enough, as active/passive modes each require other ports for data connections,

    https://learn.microsoft.com/en-us/iis/publish/using-the-ftp-service/configuring-ftp-firewall-settings-in-iis-7#more-information-about-working-with-firewalls

    You really need to learn more about the actual protocol (FTP commands) and how the packets go through ports, so as to learn how to properly set up firewall rules. The FTP server administrators might give you more hints.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.