c# - azure "The remote server returned an error: (530) Not logged in."

标签 c# asp.net asp.net-mvc-4 azure ftp

我有一个 ASP MVC4 站点。我必须在 ftp 服务器上创建一个文件夹,并使用以下代码:

FtpWebRequest ftpWebRequest = (FtpWebRequest)WebRequest.Create("ftp://mysite.altervista.org/newfolder");
ftpWebRequest.Method = WebRequestMethods.Ftp.MakeDirectory;       
ftpWebRequest.UsePassive = true;
ftpWebRequest.EnableSsl = true;
ftpWebRequest.Credentials = new NetworkCredential("userTest", "psw123456");
ftpWebRequest.KeepAlive = true;
ftpWebRequest.UseBinary = true;
using (var resp = (FtpWebResponse)ftpWebRequest.GetResponse())
 {
  Console.WriteLine("Result: " + resp.StatusCode);
 }

当我在本地主机中运行我的网站时,一切正常,但是当我将我的网站发布到 Azure 网站时,它返回一个异常:“远程服务器返回错误:(530) 未登录。” 我认为问题不在我的代码中,我是否需要更改 Azure 中的某些设置?

提前谢谢

最佳答案

删除以下 2 行并重试

ftpWebRequest.UsePassive = true;
ftpWebRequest.EnableSsl = true;

关于c# - azure "The remote server returned an error: (530) Not logged in.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24466063/

相关文章:

c# - 必须定义参数 '@email'

c# - 如何在不引用 System.Web 的情况下检查 Web.Config 中的身份验证模式值

c# - 如何在具有负值的 Chart.js 中的 Yaxis 上隐藏 0 值

c# - 按钮未命中 mvc 中的 javascript 函数

asp.net-mvc-4 - MVC AZURE WA AD 不带 ACS 退出

c# - ContentControl 未更新

c# - 如何为作为唯一列集的多值组件创建 NHibernate 映射文件?

c# - WinSCP SFTP 连接错误

c# - Web api 方法调用另一个流内容 web api 方法?

c# - 在同一 View 中显示局部 View mvc4