C# 上载ASP.Net MVC应用程序(AWS-EBS)的图像时出现运行时错误

C# 上载ASP.Net MVC应用程序(AWS-EBS)的图像时出现运行时错误,c#,asp.net,asp.net-mvc,amazon-web-services,amazon-elastic-beanstalk,C#,Asp.net,Asp.net Mvc,Amazon Web Services,Amazon Elastic Beanstalk,我的最终目标是将文件保存到AWS-EC2 windows实例中的远程内容目录中。目标文件夹是远程服务器中的“C:\inetpub\wwwroot\Content”。我正在使用它 string serveradd=Server.MapPath("/"); 我假设上述命令将自动获取远程服务器根地址。我的假设是错误的吗 用下面的代码构建项目后,我仍然得到一个运行时错误 [HttpPost] public ActionResult addimage(int? id, Image im, HttpPos

我的最终目标是将文件保存到AWS-EC2 windows实例中的远程内容目录中。目标文件夹是远程服务器中的“C:\inetpub\wwwroot\Content”。我正在使用它

string serveradd=Server.MapPath("/");
我假设上述命令将自动获取远程服务器根地址。我的假设是错误的吗

用下面的代码构建项目后,我仍然得到一个运行时错误

[HttpPost]
public ActionResult addimage(int? id, Image im, HttpPostedFileBase imagepath)
{             
         string filename = Path.GetFileNameWithoutExtension(imagepath.FileName);
         string extension = Path.GetExtension(imagepath.FileName);
         filename = filename + DateTime.Now.ToString("yymmssff") +extension;
         string serveradd=Server.MapPath("/");
         string remotepath = Path.Combine(serveradd,filename); 
         imagepath.SaveAs(remotepath);
}


这是我暂时使用的

它可能有在服务器上保存图像的权限问题它可能有在服务器上保存图像的权限问题