RazorEngine parse throws Unable to compile

I am trying to compile a razor file with this line

RazorEngine.Razor.Parse("Hello world");

But he just throws

base {System.Exception} = {"Unable to compile template. Source file 'C:\\Windows\\TEMP\\vlu4zahf.0.cs' could not be found\n\nOther compilation errors may have occurred. Check the Errors property for more information."}

And the error property looks like this:

[0] = {error CS2001: Source file 'C:\Windows\TEMP\vlu4zahf.0.cs' could not be found}
[1] = {warning CS2008: No source files specified}

So there is no good information.

I am running .NET 4.0 and Razor Engine 3.2.0.0

Update 1

I found an error in this line in RazorEngine

Tuple.Create(
                compileResult.CompiledAssembly.GetType("CompiledRazorTemplates.Dynamic." + context.ClassName),
                compileResult.CompiledAssembly);
+5
source share
2 answers

This is most likely a permission issue for the user account that makes up the razor file. Make sure on C: \ Windows \ Temp

See the help information here: http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/85f9b330-a938-4afe-a615-db83085e52d2/

+8
source

- , c:\windows\temp / . , IIS, . , , " " False. , False, , IIS 6 ( , ) - , % temp% . , False ​​ Microsoft.

, True, % temp% , . .

AppPool IIS.

powershell ( ), :

Import-Module WebAdministration
$appPoolName = "ReplaceWithYourAppPoolName"
$appPool = Get-Item IIS:\AppPools\$appPoolName
$appPool.processModel.loadUserProfile = $true
$appPool | Set-Item
+6

All Articles