3

我们的网站根据配置编译从数据库加载的自定义 c# 代码。在我们的一台开发人员机器上,我们在编译时收到文件未找到错误。此代码在其他开发人员机器上运行良好。在开发人员机器上的 Visual Studio 开发服务器下运行时,它也可以正常工作。在此特定机器上的 IIS 下运行时,它不起作用。当网站安装在默认网站的子目录下时,它以前可以工作,但自从移动到 IIS 中的单独站点后,它就没有工作了。

CompilerResults results = compiler.CompileAssemblyFromSource(
                              compilerParameters, source);

if (results != null && results.Errors.HasErrors)
{
    StringBuilder stringBuilder = new StringBuilder();
    foreach (CompilerError error in results.Errors)
    {
        stringBuilder.AppendLine(error.ErrorText);
    }

    throw new StoreTechException(
        String.Format("Unable to generate KPI calculation assembly:{0}{1}",
            Environment.NewLine, stringBuilder.ToString()), 
        StoreTechExceptionTypes.Error);
}

return results;

生成的错误消息是:

CS2001: Source file 'C:\\Windows\\TEMP\\zyxl54ci.0.cs' could not be found 
CS2008: No inputs specified

由于它在 Visual Studio 开发服务器而不是 IIS 下工作,我们想知道这是否是权限问题。

4

1 回答 1

4

应用程序池标识需要对临时目录(C:\Windows\TEMP)的写入访问权限。

于 2013-11-12T12:28:05.487 回答