.net用ftp上传文件 出错 请大家帮忙找找原因,谢谢!
生成失败。原因:System.IO.IOException: Can't connect to remote server 在 LiXun.Common.NEWFTP.CreateDataSocket() 位置 E:\Work\LiXun_Sln\LiXun.Common\NEWFTP.cs:行号 721 在 LiXun.Common.NEWFTP.Put(String strFileName) 位置 E:\Work\LiXun_Sln\LiXun.Common\NEWFTP.cs:行号 522/// <summary>
/// 上传一个文件
/// </summary>
/// <param name="strFileName">本地文件名</param>
public void Put(string strFileName)
{
if (!bConnected)
{
Connect();
}
Socket socketData = CreateDataSocket();
SendCommand("STOR " + Path.GetFileName(strFileName));
if (!(iReplyCode == 125 || iReplyCode == 150))
{
throw new IOException(strReply.Substring(4));
}
FileStream input = new
FileStream(strFileName, FileMode.Open);
int iBytes = 0;
while ((iBytes = input.Read(buffer, 0, buffer.Length)) > 0)
{
socketData.Send(buffer, iBytes, 0);
}
input.Close();
if (socketData.Connected)
{
socketData.Close();
}
if (!(iReplyCode == 226 || iReplyCode == 250))
{
ReadReply();
if (!(iReplyCode == 226 || iReplyCode == 250))
{
throw new IOException(strReply.Substring(4));
}
}
} --------------------编程问答-------------------- 还没弄过 顶一下 如果比较急的话 分数多一点 --------------------编程问答-------------------- 我已经解决了!谢谢大家。是权限问题。 --------------------编程问答--------------------
汗。 --------------------编程问答--------------------
接分啦。
补充:.NET技术 , ASP.NET