求助关于Web服务引用出现问题

WF-soft© 2018-04-22 02:52:16
web.GetFileList是获得FTP文件列表
web.Download是下载文件
两个方法都有登录FTP和关闭FTP的操作

Download方法放本地的时候没有问题,放到web.Download就引发未处理SoapException异常
这两个方法同时调用web服务是不是有什么漏洞或者冲突

        
public void DownDir(string FilePath, string FtpPath)
{
WF_web.WF_WebService web = new WF_web.WF_WebService();
var fileList = web.GetFileList(FtpPath);

if (fileList != null)
{

ThreadPool.QueueUserWorkItem((obj) =>
{
foreach (string file in fileList)
{
if (file.Contains("<DIR>")) //if this is a dir need recursion download
{
string[] temp = file.Trim().Split(new string[] { "<DIR>" }, StringSplitOptions.None);
string downloadDir = FilePath + "\\" + temp[1].Trim();
if (!Directory.Exists(downloadDir))
{
Directory.CreateDirectory(downloadDir);
}
DownDir(FilePath + "\\" + temp[1].Trim(), FtpPath + "/" + temp[1].Trim());
}
else
{
progressBarValue += 1;
string temp = file;
temp = new System.Text.RegularExpressions.Regex("[\\s]+").Replace(temp, " ");
var tempp = temp.Trim().Split(new string[] { " " }, StringSplitOptions.None);
string filename = tempp[tempp.Length - 1];
//此web.Download处发生异常
web.Download(FilePath + "\\", FtpPath + "/", filename);
Action<ListBox, String> updateAction = new Action<ListBox, String>(Settxt);
listBox.Dispatcher.BeginInvoke(updateAction, listBox, filename);
pb.Dispatcher.BeginInvoke(new ProgressBarSetter(SetProgressBar), progressBarValue);
}
}
}, null);
if ((int)progressBarValue == (int)FileNum)
{
listBox.Items.Insert(0, "更新完成----------------------");
MessageBox.Show("更新完成");
}
}
}
...全文
341 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

110,567

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧