[英]Could not find a part of the path 'xxx\xxx.xlsx'
I have a MVC application which utilized Open XML to upload excel files. 我有一个MVC应用程序,该应用程序利用Open XML上传Excel文件。 Everything works fine on my local machine, but as soon as I deploy it it doesn't seem to work and throws the above exception.
一切在我的本地计算机上都可以正常运行,但是一旦我部署它,它似乎就无法正常工作并抛出上述异常。 I have given permissions to the folder for user running in IIS, which is a AD account I created.
我已为在IIS(我创建的AD帐户)中运行的用户授予了该文件夹的权限。 But still throws the exception.
但是仍然抛出异常。 I have seen some posts about this but I am having no luck.
我已经看到了一些有关此的帖子,但是我没有运气。 Please see my code below and maybe advice on any changes.
请在下面查看我的代码,并就任何更改提出建议。
public ActionResult Upload(HttpPostedFileBase file, string sSheetName)
{
string sid = HttpContext.Session.SessionID;
List<CleanSupplierClaim> supplierClaimsData = new List<CleanSupplierClaim>();
try
{
if (file.ContentLength > 0)
{
var fileName = file.FileName;
var targetFolder = Server.MapPath("~/upload/");
string targetPath = Path.Combine(targetFolder, fileName);
file.SaveAs(targetPath);
将以下行添加到web.config中,以使用AD帐户运行应用程序。
<identity impersonate="true" userName="domain\user" password="password" />
Have a look at these troubleshooting items for you... They should get you going... 看看这些故障排除项目为您...它们应该帮助您...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.