I have code that dynamically compiles Razor templates into an assembly that I execute using a set of permissions (without access to files, etc.).
This works on our development computers and on our test server (Windows 2008 IIS7 x64.NET 4). But on our production server (Same spec) it gives an error:
"Downloading this assembly will result in a different set of grants from other instances. (Exception from HRESULT: 0x80131401)"
Here is the code: -
public static SandboxContext Create(string pathToUntrusted, List<Assembly> references) { AppDomainSetup adSetup = new AppDomainSetup(); adSetup.ShadowCopyFiles = "true"; var dir = new DirectoryInfo(pathToUntrusted); String tempPath = Path.Combine(Path.GetTempPath(), dir.Name + "_shadow"); adSetup.CachePath = tempPath;
Any ideas why this will be different on the same server? I just installed all the outstanding Windows updates on a broken server and that didn't help.
If I changed PermissionSet to: -
PermissionSet permSet = new PermissionSet(PermissionState.Unrestricted);
All code works (but presumably with a security issue)
source share