私はASP.NET Webサービスでシンプルなクラスを持っています。それを私のローカルシステム上にあっても、私が設定した開発環境上で細かい動作しますが、いつでも、私は次のエラーを取得する運用サーバー上のファイルを送信しよう:IIS7.5と.NET 4.0でFTPWebRequestを使用する際のエラー
Exception Error: The underlying provider failed on Open.
ここにあるコードがあります
public class FTPHelper
{
public static string SendFile(string ftpuri, string username, string password, string ftppath, string filename, byte[] datatosend)
{
if (ftppath.Substring(ftppath.Length - 1) != "/")
{
ftppath += "/";
}
FtpWebRequest ftp = (FtpWebRequest) FtpWebRequest.Create(ftpuri + ftppath + filename);
ftp.Method = WebRequestMethods.Ftp.UploadFile;
ftp.Credentials = new NetworkCredential(username, password);
ftp.UsePassive = true;
ftp.ContentLength = datatosend.Length;
Stream requestStream = ftp.GetRequestStream();
requestStream.Write(datatosend, 0, datatosend.Length);
requestStream.Close();
FtpWebResponse ftpresponse = (FtpWebResponse)ftp.GetResponse();
return ftpresponse.StatusDescription;
}
}
この問題のトラブルシューティングを行うにはどうすればよいですか。サーバーは、Windows 2008 Server上で実行されているIIS 7.5です。私は.NET 4.0を使用しています。 FtpWebResponseが機能しない単純な理由はありますか?
セキュリティ上の問題が発生した場合は、回避策がありますか?私はすぐにこれを稼働させる必要があります。
私は一週間後、一人ではこれで私を助けることができなかったことは驚きです。恩恵を受けたとしても、誰も答えはありませんでした。 – stephenbayer