0
即时通讯从Azure web服务web应用程序使用简单的ASP.net应用程序 我有这样的代码,它应该使我能够将文件上传到我运行相同的服务器web应用程序。 这样的:使用ASP.net mvc上传文件到azure iis web应用程序失败
try
{
FtpWebRequest r = (FtpWebRequest)WebRequest.Create("ftp://www.ftp.azurewebsites.windows.net/site/wwwroot/myfiles/FTP");
r.KeepAlive = true;
r.UseBinary = true;
r.Method = WebRequestMethods.Ftp.UploadFile;
r.Credentials = new NetworkCredential("myapp\userA","password123");
FileStream fs = System.IO.File.OpenRead(source + "sourceFile.json");
byte[] fileBytes = new byte[fs.Length];
fs.Read(fileBytes, 0, fileBytes.Length);
fs.Close();
r.ContentLength = fileBytes.Length;
r.UsePassive = false;
r.UseBinary = true;
r.ServicePoint.ConnectionLimit = fileBytes.Length;
r.EnableSsl = false;
using (Stream requestStream = r.GetRequestStream())
{
requestStream.Write(fileBytes, 0, fileBytes.Length);
requestStream.Close();
}
FtpWebResponse rs = (FtpWebResponse)r.GetResponse();
rs.Close();
catch (WebException ex)
{
throw new Exception((ex.Response as FtpWebResponse).StatusDescription);
}
2怪事happning,
当我运行从Visual Studio代码在本地我没有抛出异常 但文件永远不会创建 1。
2.当我从我的web应用程序即时得到运行这段代码:
500 (Internal Server Error)
这里有什么问题?
你解决了这个问题吗? –