Glimpse in Medium Trust
Is there any way to get Glimpse to work in Medium Trust?
If I set <glimpse enabled="true"/>
in my web.config, I get a Security Exception:
[SecurityException: Request failed.]
System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0
System.Security.CodeAccessSecurityEngine.Check(PermissionSet permSet, StackCrawlMark& stackMark) +31
System.Security.PermissionSet.Demand() +68
System.Security.CodeAccessSecurityEngine.CheckGrantSetHelper(PermissionSet grantSet) +57
System.Reflection.Emit.AssemblyBuilder.nCreateDynamicAssembly(AppDomain domain, AssemblyName name, Evidence identity, StackCrawlMark& stackMark, PermissionSet requiredPermissions, PermissionSet optionalPermissions, PermissionSet refusedPermissions, Byte[] securityRulesBlob, Byte[] aptcaBlob, AssemblyBuilderAccess access, DynamicAssemblyFlags flags, SecurityContextSource securityContextSource) +0
System.Reflection.Emit.AssemblyBuilder..ctor(AppDomain domain, AssemblyName name, AssemblyBuilderAccess access, String dir, Evidence evidence, PermissionSet requiredPermissions, PermissionSet optionalPermissions, PermissionSe开发者_运维技巧t refusedPermissions, StackCrawlMark& stackMark, IEnumerable`1 unsafeAssemblyAttributes, SecurityContextSource securityContextSource) +198
System.Reflection.Emit.AssemblyBuilder.InternalDefineDynamicAssembly(AssemblyName name, AssemblyBuilderAccess access, String dir, Evidence evidence, PermissionSet requiredPermissions, PermissionSet optionalPermissions, PermissionSet refusedPermissions, StackCrawlMark& stackMark, IEnumerable`1 unsafeAssemblyAttributes, SecurityContextSource securityContextSource) +125
System.AppDomain.InternalDefineDynamicAssembly(AssemblyName name, AssemblyBuilderAccess access, String dir, Evidence evidence, PermissionSet requiredPermissions, PermissionSet optionalPermissions, PermissionSet refusedPermissions, StackCrawlMark& stackMark, IEnumerable`1 assemblyAttributes, SecurityContextSource securityContextSource) +43
System.AppDomain.DefineDynamicAssembly(AssemblyName name, AssemblyBuilderAccess access) +42
System.ComponentModel.Composition.MetadataViewGenerator..cctor() +257
From what I can tell, the error is similar to the one described here. Basically, MEF isn't able to do its trick of populating a meta-data instance implementing a particular interface when the app is running in Medium Trust.
Unfortunately currently Glimpse requires Full Trust, you could file an enhancement request with them, most features should be available in Medium Trust as well.
精彩评论