I이 폴더에 업로드 된 파일을 추가하려면 다음과 같은 액션 메소드, 내 asp.net MVC 웹 응용 프로그램을 제작 한 후, 내 콘텐츠 폴더 안에 파일을 업로드 할 수 없습니다 : -IIS
if (ModelState.IsValid)
{
string ADusername = User.Identity.Name.Substring(User.Identity.Name.IndexOf("\\") + 1);
repository.InsertOrUpdateDataCenter(dc, ADusername);
repository.Save();
if (DataCenterfile != null)
{
var fileName = Path.GetFileName(DataCenterfile.FileName);
var path = Path.Combine(Server.MapPath(Url.Content("~/Content/uploads")), dc.ID + ".png");
DataCenterfile.SaveAs(path);
}
return RedirectToAction("Details", new { id = dc.ID });
}
하지만 난 다음과 같은 예외가 무엇입니까 : - 내가 IIS에 내 웹 응용 프로그램을 게시 한
Server Error in '/TMS' Application.
Could not find a part of the path 'C:\inetpub\wwwroot\TMS\Content\uploads\97.png'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\inetpub\wwwroot\TMS\Content\uploads\97.png'.
Source Error:
위가 잘 작동하고 있다는 사실을 드러내는,하지만 이후 나는이 오류를 받기 시작. 그래서 내가 어떻게이 문제를 해결할 수있는 사람이 조언을 할 수 있습니까? 감사
바보 같은 질문이지만 '/ Content' 폴더가 게시 된 IIS 사이트에 있습니까? 게시 할 때 포함되지 않았을 수도 있습니다. –
감사합니다, 나는 IIS 관리자를 확인하고 당신은 Visual Studio에서 응용 프로그램에 액세스 할 때 내 응용 프로그램의 일부인 altohugh 업로드 폴더가 IIS 내부에없는 것입니다. 왜 그것이 포함되지 않았고 어떻게 포함시킬 수 있습니까? –