The underlying connection was closed. The server committed a protocol violation. RRS feed

  • Question

  • Hi All,

    I have developed an Window Service application using c# for reading files from FTP server. It is working fine for 2 days continously but after that it is throwing an exception which is "The underlying connection was closed. The server committed a protocol violation."

    Here is my code :

    FtpWebRequest reqobj = (FtpWebRequest)FtpWebRequest.Create(strFTPFilePath);

    reqobj.UseBinary = true;

    reqobj.Credentials = new NetworkCredential(FTPUserName, FTPPassword);

    reqobj.UsePassive = false;

    reqobj.KeepAlive = false;

    reqobj.Method = WebRequestMethods.Ftp.ListDirectory;

    WebResponse tempres = reqobj.GetResponse();

    StreamReader temreader = new StreamReader(tempres.GetResponseStream());

    string filename = temreader.ReadLine();

    while (filename != null)



    filename = temreader.ReadLine();




    return filelist;

    Please help me to resolve this issue. I am very irritated from this error.

    Thanks All in advance

    Thursday, March 7, 2013 1:00 PM

All replies

  • Rajeev,

    Sorry. This forum is restricted to questions related to Project Server. You probably will get a prompt and accurate resposnse if you post it to relevant windows forum.

    Prasanna Adavi, PMP, MCTS

    Thursday, March 7, 2013 2:18 PM