0
webserviceを使用してFTPサーバー内のファイルをダウンロードしようとしています。webservice FTPをデプロイする際にエラーが発生しました。C#
[WebMethod]
public string BrowseFileSimplify(string FileName, string varlocaldirectory)
{
Regex regex = new Regex(@"[a-zA-Z_-]+?\.[a-zA-Z]{1,5}$");
Match match = regex.Match(FileName);
if (match.Success)
{
try
{
string inputfilepath = varlocaldirectory + "\\" + FileName;
using (WebClient request = new WebClient())
{
request.Credentials = new NetworkCredential(UserName, Password);
byte[] fileData = request.DownloadData(uri+FileName);
using (FileStream file = File.Create(inputfilepath))
{
file.Write(fileData, 0, fileData.Length);
file.Close();
}
return "Download Success";
}
}
catch (Exception ex)
{
return "Problem with " + ex.Message; //Error en la aplicacion
}
}
else
{
return "Error with file format"; //Error en el formato del archivo
}
}
私はVisualStudioをして実行すると、それは「成功のダウンロード」が、私はそれを返すwebにアップロードする際に返し、正常に動作します:「エラー:リモートサーバーに接続できません」
をweb.configにコードを入れる必要がありますか?
ありがとうございます。
ホストでした。私は紺碧のような別のホストで試してみました。ありがとう。 – cport93