Attempt to access the method failed

Topics: Caching Application Block
Jan 24, 2007 at 8:50 PM
I would like to use the caching block from Enterprise Library 2.0 January 2006 within an Analysis Services .NET stored procedure. The procedure is given the maximum trust (External) and runs under the LocalSystem account. Unfortunately, instantiating the Cache Manager (CacheManager cache = CacheFactory.GetCacheManager();) fails with the exception above. Upon debugging, the offending code is in the CreateConfigurationNameMapper class inside

private IConfigurationNameMapper CreateConfigurationNameMapper(Type type)
ConfigurationNameMapperAttribute attribute
= GetCustomAttribute<ConfigurationNameMapperAttribute>(type);
if (attribute != null)
return (IConfigurationNameMapper)Activator.CreateInstance(attribute.NameMappingObjectType); // "Attempt to access the method failed" exception here!!!
return null;

The attribute.NameMappingObjectType property returns "cacheManagerDataRetriever". I tried several things to resolve the CAS permission including granting the assembly AllowPartiallyTrustCallers and asserting the ReflectionPermission at the beginning of CreateConfigurationNameMapper as follows:

ReflectionPermission rp = new ReflectionPermission(System.Security.Permissions.PermissionState.Unrestricted);

I haven't been succesfully so far to resolve the issue. Ideas?
Jan 25, 2007 at 1:52 PM
Never mind. Elevating the permission set to Unrestricted fixed the issue.