问题
We developed an ftp file upload application using c# The application has worked flawlessly for a long time. For past few days, user reported that he got an error "The remote server returned an error: (550) File unavailable (e.g., file not found, no access)." We quite surprised as we do not make any changing in the coding and environment.
This error is pop out by
WebRequest request = WebRequest.Create(directoryPath);
request.Method = WebRequestMethods.Ftp.MakeDirectory;
request.Credentials = new NetworkCredential(ftpUser, ftpPassword);
using (var resp = (FtpWebResponse)request.GetResponse())
{
resp.Close();
}
So we do some testing to try to figure out the issue
- Use filezilla to create a directory ,it works fine.
- Create a directory through window explorer, it works fine too
we found that if we delete some directory with files from ftp directory ,it will resumed normal, user can upload an file through the c# ftp upload application again.
I guess if the ftp can set the max no of directory or file, if the no of directory reach the setting ,it will close the connection
Finally we try to use Wireshark to see the ftp packet. And found an info that the different between the normal ftp packet and unnormal ftp packet is "Response: 550 The specified network name is no longer available. "
Normal ftp packet Response: 250 CWD command successful. Request: PASV Response: 227 Entering Passive Mode (172,25,230,110,212,41). Request: NLST OAP Response: 125 Data connection already open; Transfer starting. Response: 226 Transfer complete. Request: CWD / Response: 250 CWD command successful.
unnormal ftp packet Response: 250 CWD command successful. Request: PASV Response: 227 Entering Passive Mode (172,25,230,110,201,251). Request: NLST OAP Response: 125 Data connection already open; Transfer starting. Response: 550 The specified network name is no longer available. Response: 220 Microsoft FTP Service
Does anyone know if the ftp can set the max directory per directory? And help will be appreciated.
回答1:
MSDN seems to suggest that your path is considered relative, and therefore it tries to log in to the FTP server using the supplied credentials, then sets the current directory to the /path directory. If this isn't the same directory where your file is, you'll get a 550 error.
回答2:
Apparently this could also be from antivirus interference.
We have done some additional testing so I figured I would come back with an update. Ever since I disabled AVG's resident shield we stopped receiving the error message
and
This was happening to me between VPN locations. The SonicWALL had Gateway Antivirus turned on and it was blocking CIFS/Netbios communication. I just turned that portion of the Gateway AV off. Works now.
https://community.spiceworks.com/topic/239423-the-specified-network-name-is-no-longer-available-while-writing-to-shared-dir
来源:https://stackoverflow.com/questions/44107643/c-sharp-ftp-response-550the-specified-network-name-is-no-longer-available