简体   繁体   中英

CSharpCodeProvider CompileAssemblyFromSource file not found under IIS

Our website compiles custom c# code loaded from the database depending on configuration. On one of our developer machines we're getting a file not found error when compiling. This code works fine on other developer machines. It also works fine when run under the Visual Studio development server on the developers machine. It does not work when run under IIS on this specific machine. It was previously working when the website was installed under a sub directory of the default website but it hasn't worked since moving to a separate site in 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;

The error messages generated are:

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

As it's working under the Visual Studio development server but not IIS we're wondering if it's a permissions issue.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM