【发布时间】:2013-05-05 07:13:57
【问题描述】:
我需要为临时文件使用一些文件夹。 我尝试使用
string directoryPath = HttpContext.Current.Server.MapPath("~/tempFiles");
但是当我将它发布到 IIS 时,我遇到了权限问题。
所以我尝试使用:
string directoryPath = Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData);
当我从 VS2012 运行我的 Web 应用程序时,它工作正常,但是当我将它发布到 iis 并在那里运行时,我得到一个空字符串。
我检查了 loadUserProfile 是“真”。
还有什么建议吗?
【问题讨论】:
-
您的 IIS 是否在完全信任的环境中运行?
-
@TamarG:尝试将 ApplicationPoolIdentity 设置为 LocalSystem
标签: c# iis-7 directory special-folders