C# FTP Response 550:The specified network name is no longer available

China☆狼群 提交于 2021-02-20 02:57:28

问题


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

  1. Use filezilla to create a directory ,it works fine.
  2. 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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!