3

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.

6
  • 1
    What version of Windows/IIS? What identity is your site's pool account running under? Commented Nov 8, 2013 at 16:51
  • @Kev Windows 7 Professional. IIS 7.5. I'll need to wait until Tuesday to answer the second question for certain when I next meet the developer. I'm not aware that anything unusual has been done with the app pool apart from setting it to .NET 4.0 so it's probably whatever the default is. Commented Nov 8, 2013 at 19:57
  • 1
    I have had the same error messages. In my case the application pool identity hasn't had enough rights. Commented Nov 11, 2013 at 12:05
  • @lippo What were the specific rights needed in order to enable code compilation? Commented Nov 11, 2013 at 13:15
  • 1
    I've choosen an easy way. I've add the Application Pool User to Administrator Group. But I think the user only need write permission on the temp dir. Commented Nov 11, 2013 at 13:43

1 Answer 1

4

The application pool identity needs write access on the temp dir (C:\Windows\TEMP).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.