I have a problem that only occur when I run my application from the IIS.
I am trying to FTP from my ASP.NET application to an external site.
I can FTP from the server in general but not from my application. My request times out.
The owner of my Website is now set to the IIS_IUSRS user with Full control.
Do anyone have ANY idea what might keeps me from succeeding?
Any help will be extremely appriciated.
My Deadline is within 12 hours and I am royaly screwed...
Same problem solve UsePassive . Maybe you can add allow port 20,21 for FTP on firewall (For me not necessery).
FtpWebRequest reqFTP;
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(@"ftp://ftp.example.com/"));
reqFTP.UseBinary = true;
reqFTP.Credentials = new NetworkCredential("user", "password");
reqFTP.Proxy = null;
reqFTP.KeepAlive = false;
reqFTP.UsePassive = true;
A quick fix may be setting the anonymous user that IIS uses to your user account instead of the IUSR account (in IIS). It does seem to be a permission problem.
Second bet would be to use a tool like Wiresharck/Etherreal and check if any connection to the FTP site is made, and debug from there.
I Found the Solution
Windows Firewall and non-secure FTP traffic
Windows firewall can be configured from command line using netsh command. 2 simple steps are required to setup Windows Firewall to allow non-secure FTP traffic
1) Open port 21 on the firewall
netsh advfirewall firewall add rule name="FTP (no SSL)" action=allow protocol=TCP dir=in localport=21
2) Activate firewall application filter for FTP (aka Stateful FTP) that will dynamically open ports for data connections
netsh advfirewall set global StatefulFtp enable
I don't really know what that just did but it did the trick
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.