Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SecurityException assembly does not alllow partially trusted callers

798480Feb 24 2011 — edited Feb 25 2011
I have seen a few posts everywhere about this but am still slightly confused as to how this should work. I am not sure if this is a problem due to the Tangosol library not containing the allow partially trusted callers attribute or something else more fundamental with the policy restrictions on how .NET applications are called over the network.

My app.config is:

<?xml version="1.0"?>

<configuration>
<configSections>
<section name="coherence" type="Tangosol.Config.CoherenceConfigHandler, Coherence"/>
</configSections>

<coherence>
<cache-factory-config>\\usfiapp\swap_prd\MBS\PNG\Server\DEV\config\coherence.xml</cache-factory-config>
<cache-config>\\usfiapp\swap_prd\MBS\PNG\Server\DEV\config\cache-config.client.xml</cache-config>
<pof-config>\\usfiapp\swap_prd\MBS\PNG\Server\DEV\config\pof-config.xml</pof-config>
</coherence>
</configuration>

and when I run my application from a Network Share I get the error and stack trace as shown:

{ERROR}[1]02/24 13:30:03 - Exception in the main thread
System.Configuration.ConfigurationErrorsException: An error occurred creating the configuration section handler for coherence: That assembly does not allow partially trusted callers. (\\usfiapp\swap_prd\MBS\PNG\Server\DEV\bin\CacheLoader\ConsoleService.exe.Config line 5) ---> System.Security.SecurityException: That assembly does not allow partially trusted callers.
at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed)
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)
at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Configuration.TypeUtil.CreateInstanceWithReflectionPermission(Type type)
at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.Init(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord)
at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.InitWithRestrictedPermissions(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord)
at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory..ctor(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord)
at System.Configuration.RuntimeConfigurationRecord.CreateSectionFactory(FactoryRecord factoryRecord)
at System.Configuration.BaseConfigurationRecord.FindAndEnsureFactoryRecord(String configKey, Boolean& isRootDeclaredHere)
The action that failed was:
LinkDemand
The assembly or AppDomain that failed was:
System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
The Zone of the assembly that failed was:
MyComputer
The Url of the assembly that failed was:
file:///C:/WINNT/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
--- End of inner exception stack trace ---
at System.Configuration.BaseConfigurationRecord.FindAndEnsureFactoryRecord(String configKey, Boolean& isRootDeclaredHere)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSection(String configKey, Boolean getLkg, Boolean checkPermission)
at System.Configuration.BaseConfigurationRecord.GetSection(String configKey)
at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName)
at System.Configuration.ConfigurationManager.GetSection(String sectionName)
at Tangosol.Util.ConfigurationUtils.GetCoherenceConfiguration() in c:\dev\release.net\coherence-net-v3.5\src\Coherence\Util\ConfigurationUtils.cs:line 37
at Tangosol.Net.CacheFactory.get_Config() in c:\dev\release.net\coherence-net-v3.5\src\Coherence\Net\CacheFactory.cs:line 272
at Tangosol.Net.CacheFactory.get_ConfigurableCacheFactoryConfig() in c:\dev\release.net\coherence-net-v3.5\src\Coherence\Net\CacheFactory.cs:line 392
at Tangosol.Net.CacheFactory.get_ConfigurableCacheFactory() in c:\dev\release.net\coherence-net-v3.5\src\Coherence\Net\CacheFactory.cs:line 331
at Tangosol.Net.CacheFactory.GetCache(String name) in c:\dev\release.net\coherence-net-v3.5\src\Coherence\Net\CacheFactory.cs:line 643
at Bnpp.Irg.PoolManager.ComponentReportCache..ctor() in L:\src\Applications\PoolManagerReplacement\BNPPOF\BNPPOF\POFCacheFactory.cs:line 379
at Bnpp.Irg.PoolManager.ComponentReportFactory.GetPOFCache() in L:\src\Applications\PoolManagerReplacement\BNPPOF\BNPPOF\POFCacheFactory.cs:line 563
at Bnpp.Irg.PoolManager.POFCacheAssembler.AssemblePOFCache(String pofCacheType) in L:\src\Applications\PoolManagerReplacement\BNPPOF\BNPPOF\POFCacheFactory.cs:line 90
at Bnpp.Irg.PoolManager.Program.DeRegister(CtrlTypes t) in L:\src\Applications\PoolManagerReplacement\Server\CacheLoader\CacheLoaderService\Program.cs:line 127
at Bnpp.Irg.PoolManager.Program.Main(String[] args) in L:\src\Applications\PoolManagerReplacement\Server\CacheLoader\CacheLoaderService\Program.cs:line 192

Looking on MSDN and other places some say to rebuild the Ent Lib with the AllowPartiallyTrustedCallers() attribute and others say to grant the unc share folder "FullTrust" through URL evidence. I have tried the latter by going to the .NET configuration and creating a new code group under LocalIntranet _Zone called DEVCode with the share from which I am loading the application and trust set to Full Trust.

This still did not work and I am not sure what part of the Ent Lib I need to rebuild, so how can I get around this. Can you please help?

Do I need to restart the server on which I am running the network application from after making such a policy change?
FYI - I am running the application from a Windows Service if that helps.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 25 2011
Added on Feb 24 2011
2 comments
461 views