2009-12-29 8 views
1

Je reçois une exception après la mise à niveau de Spring.NET 1.2 vers 1.3 dans mon application Web. Voici la configuration de mon application Web:Exception de sécurité sur IIS 7.5 sans dossier partagé

J'ai créé un pool d'applications avec son identité définie sur ApplicationPoolIdentity. J'utilise NHibernate 2.1, mon SQL Server 2008 est local et j'utilise l'authentification SQL Server. Il n'y a pas de réseau ou de dossier partagé. Tout est local.

Maintenant, la chose étrange est que si je change l'identité de mon pool d'applications dans IIS à NetworkService, il commence à fonctionner correctement. Je me demande quel est le problème avec la définition de l'identité de mon pool d'applications à ApplicationPoolIdentity.

est ici l'exception:

System.Configuration.ConfigurationErrorsException: Error creating context '/project1': That assembly does not allow partially trusted callers. ---> Spring.Objects.Factory.ObjectCreationException: Error thrown by a dependency of object 'MyObj' defined in 'file [D:\Projects\MyProject\Configs\Services.xml] line 37' : Initialization of object failed : Failed to create an instance of 'Spring.Data.NHibernate.Bytecode.ProxyFactoryFactory'! 
    while resolving 'Sleepers[0]' to 'CustomerManager' defined in 'file [D:\Projects\MyProject\Configs\Business.xml] line 64' 
    while resolving 'CustomerDAO' to 'CustomerDAO' defined in 'file [D:\Projects\MyProject\Configs\Dao.xml] line 50' 
    while resolving 'SessionFactory' to 'SessionFactory' defined in 'file [D:\Projects\MyProject\Configs\Dao.xml] line 21' ---> NHibernate.Bytecode.HibernateByteCodeException: Failed to create an instance of 'Spring.Data.NHibernate.Bytecode.ProxyFactoryFactory'! ---> 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 NHibernate.Bytecode.ActivatorObjectsFactory.CreateInstance(Type type) 
     at NHibernate.Bytecode.AbstractBytecodeProvider.get_ProxyFactoryFactory() 
    The action that failed was: 
    LinkDemand 
    The assembly or AppDomain that failed was: 
    NHibernate, Version=2.1.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4 
    The Zone of the assembly that failed was: 
    Internet 
    The Url of the assembly that failed was: 
    file:///D:/Projects/MyProject/bin/NHibernate.DLL 
     --- End of inner exception stack trace --- 
+0

"J'utilise NHibernate 2.1" Est-ce la version 2.1.2.4000? – BennyM

+0

Oui, c'est la même version. –

Répondre

1

IIS tente de charger et d'exécuter l'assemblée à l'adresse: file:///D:/Projects/MyProject/bin/NHibernate.DLL.

exécution cela résoudra les problèmes d'autorisation dans cette machine:

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\caspol.exe -addgroup 1.2 -url 
"file:///D:/Projects/MyProject/bin/*" FullTrust 
Questions connexes