Microsoft Dynamics NAV --------------------------- Fehler bei einem Aufruf von TemplateEngine.TemplateEngine.Render mit folgender Meldung: Fehler beim Versuch der SecurityTransparent-Methode "RazorEngine.Engine.get_IsolatedRazor()", auf die sicherheitskritische Methode "RazorEngine.Templating.IsolatedRazorEngineService.Create()" zuzugreifen. Die Assembly "RazorEngine, Version=3.7.7.0, Culture=neutral, PublicKeyToken=9ee697374c7e744a" ist mit "AllowPartiallyTrustedCallersAttribute" markiert und verwendet das Sicherheitstransparenzmodell der Stufe 2. Bei Festlegung der Transparenz auf Stufe 2 werden alle Methoden in AllowPartiallyTrustedCallers-Assemblys standardmäßig sicherheitstransparent, was die Ursache der Ausnahme sein kann. --------------------------- OK ---------------------------
// We have to load Razor with full trust (so all methods are SecurityCritical) // This is because we apply AllowPartiallyTrustedCallers to RazorEngine, because // We need the untrusted (transparent) code to be able to inherit TemplateBase.
Answers
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
Assemblies running in AllowPartiallyTrustedCallers mode are supposed to be run with full trust. As I deployed the assembly via copy & paste to the remote machine, the assembly owner was my domain user rather than the target machine itself - which in turn disallowed full trust mode.
Setting the assembly owner to either 'Everyone', or to the local machine solved the issue.
Thanks @kriki for moving this thread.