C#.NET FTP缺少依赖? FTP

时间:2021-10-24 03:44:36

I have some c# code that downloads files from an FTP server. It works fine when I run it and it works fine when I install it on my development machine then run it. However, when I try to install it on another machine (a Windows XP SP3 VM) it doesn't work. No exceptions are thrown or anything.

我有一些c#代码从FTP服务器下载文件。当我运行它时工作正常,当我在我的开发机器上安装它然后运行它时工作正常。但是,当我尝试将其安装在另一台计算机(Windows XP SP3 VM)上时,它无法正常工作。不会抛出异常或任何异常。

Here is the short version of my code:

这是我的代码的简短版本:

reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + ftpServerIP + dir + "/"));
reqFTP.BeginGetResponse(new AsyncCallback(DLFilesInDirCallback), state);

.......

public void DLFilesInDirCallback(IAsyncResult ar)
{
   MessageBox.Show("dcallbk");
   ..... }

The message box never comes up when I run the installed version on another computer. Is there a missing dependency or something I need to install before it can be run on another machine? .net framework 4 is already installed on the xp machine. I tried turning my firewall off, and tried synchronous ftp with the same result.

当我在另一台计算机上运行安装的版本时,消息框永远不会出现。是否缺少依赖项或我需要安装的东西才能在另一台机器上运行? .net框架4已经安装在xp机器上。我尝试关闭防火墙,尝试使用相同的ftp同步结果。

Thanks, Matt

谢谢,马特

3 个解决方案

#1


2  

Try using .NET Reflector to look at your executable. You should be able to see what dependencies it has using that.

尝试使用.NET Reflector查看您的可执行文件。您应该能够看到它使用的依赖项。

#2


2  

Try to use synchronous method for testing purpose or use EndGetResponse method to get an exception. BeginGetResponse wouldn't throw the exception on it's own.

尝试使用同步方法进行测试或使用EndGetResponse方法获取异常。 BeginGetResponse不会自己抛出异常。

#3


1  

Sounds Like a network issue or User rights error. Check the systems event log when you run the application the error could be hidden from you. On the local machine try using windows explorer to ftp a text file using the same URI that your program uses. You may need to elevate the users accesss or run your app as admin.

听起来像网络问题或用户权限错误。运行应用程序时检查系统事件日志,可能会向您隐藏错误。在本地计算机上尝试使用Windows资源管理器使用程序使用的相同URI来ftp文本文件。您可能需要提升用户访问权限或以管理员身份运行您的应用。

#1


2  

Try using .NET Reflector to look at your executable. You should be able to see what dependencies it has using that.

尝试使用.NET Reflector查看您的可执行文件。您应该能够看到它使用的依赖项。

#2


2  

Try to use synchronous method for testing purpose or use EndGetResponse method to get an exception. BeginGetResponse wouldn't throw the exception on it's own.

尝试使用同步方法进行测试或使用EndGetResponse方法获取异常。 BeginGetResponse不会自己抛出异常。

#3


1  

Sounds Like a network issue or User rights error. Check the systems event log when you run the application the error could be hidden from you. On the local machine try using windows explorer to ftp a text file using the same URI that your program uses. You may need to elevate the users accesss or run your app as admin.

听起来像网络问题或用户权限错误。运行应用程序时检查系统事件日志,可能会向您隐藏错误。在本地计算机上尝试使用Windows资源管理器使用程序使用的相同URI来ftp文本文件。您可能需要提升用户访问权限或以管理员身份运行您的应用。