2012-04-20 2 views
1

최근 봄과 nhiberate를 사용하는 .NET 3.5 콘솔 응용 프로그램을 .NET 4.0으로 마이그레이션했습니다. 이 응용 프로그램은 .net 3.5에서 네트워크 공유를 해제하고 .net 4.0에서 로컬 드라이브를 종료했지만 네트워크를 시작할 때 .net 4.0으로 마이그레이션하면 다음과 같은 오류가 발생합니다.인트라넷 공유의 Springframework .NET 4.0 콘솔 응용 프로그램

Unhandled Exception: System.TypeInitializationException: The type initializer for 'Spring.Context.Support.ContextRegistry' threw an exception. 
    ---> Common.Logging.ConfigurationException: Failed obtaining configuration for Common.Logging from configuration section 'common/logging'. 
    ---> System.Configuration.ConfigurationErrorsException: An error occurred creating the configuration section handler for common/logging: That assembly does not allow partially trusted callers. (Z:\Tools\SaaSDataPoster\SaaSDataPoster.exe.Config line 6) 
    ---> System.Security.SecurityException: That assembly does not allow partially trusted callers. 
     at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(RuntimeAssembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandleInternal rmh, SecurityAction action, Object demand, IPermission permThatFailed) 
     at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) 
     at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache) 
     at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, 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.CreateSectionFactory(FactoryRecord factoryRecord) 
     at System.Configuration.BaseConfigurationRecord.FindAndEnsureFactoryRecord(String configKey, Boolean& isRootDeclaredHere) 
     --- 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) 
     at System.Configuration.ConfigurationManager.GetSection(String sectionName) 
     at Common.Logging.LogManager.<>c__DisplayClass3.<BuildLoggerFactoryAdapter>b__0() 
     at Common.Logging.Configuration.ArgUtils.<>c__DisplayClass13.<Guard>b__12() 
     at Common.Logging.Configuration.ArgUtils.Guard[T](Function`1 function, String messageFormat, Object[] args) 
     --- End of inner exception stack trace --- 
     at Common.Logging.Configuration.ArgUtils.Guard[T](Function`1 function, String messageFormat, Object[] args) 
     at Common.Logging.LogManager.BuildLoggerFactoryAdapter() 
     at Common.Logging.LogManager.get_Adapter() 
     at Common.Logging.LogManager.GetLogger(Type type) 
     at Spring.Context.Support.ContextRegistry..cctor() in c:\_prj\spring-  net\trunk\src\Spring\Spring.Core\Context\Support\ContextRegistry.cs:line 60 
     --- End of inner exception stack trace --- 
     at Spring.Context.Support.ContextRegistry.GetContext() 

<NetFx40_LegacySecurityPolicy enabled="true" />을 추가하고 CasPol.exe을 사용하여 인트라넷 영역에 완전히 신뢰하도록했습니다 (이 때 응용 프로그램은 .net 2.0 임).

.net 4.0 용으로 컴파일 된 spring.net 바이너리도 사용하고 있습니다.

내 어셈블리에는 모두 강력한 이름이 있습니다. 그게 도움이되는지 아프지는 모르겠다.

내 실행 어셈블리의 IsFullTrusted 속성도 true를 반환합니다.

누구나 봄, 넷 4.0 및 네트워크 공유에 어떤 행운이 있었습니까? 이하

caspol -m -lg로부터의 출력이다

32 비트 :

Code Groups: 

    1. All code: Nothing 
     1.1. Zone - MyComputer: FullTrust 
      1.1.1. StrongName - 002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD2900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293: FullTrust 
      1.1.2. StrongName - 00000000000000000400000000000000: FullTrust 
     1.2. Zone - Intranet: FullTrust 
      1.2.1. All code: Same site Web 
      1.2.2. All code: Same directory FileIO - 'Read, PathDiscovery' 
     1.3. Zone - Internet: Internet 
      1.3.1. All code: Same site Web 
     1.4. Zone - Untrusted: Nothing 
     1.5. Zone - Trusted: Internet 
      1.5.1. All code: Same site Web 

64 비트 :

Code Groups: 

    1. All code: Nothing 
     1.1. Zone - MyComputer: FullTrust 
      1.1.1. StrongName - 002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD2900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293: FullTrust 
      1.1.2. StrongName - 00000000000000000400000000000000: FullTrust 
     1.2. Zone - Intranet: FullTrust 
      1.2.1. All code: Same site Web 
      1.2.2. All code: Same directory FileIO - 'Read, PathDiscovery' 
     1.3. Zone - Internet: Internet 
      1.3.1. All code: Same site Web 
     1.4. Zone - Untrusted: Nothing 
     1.5. Zone - Trusted: Internet 
      1.5.1. All code: Same site Web 

답변

0

내가 일부를 포함하는 어셈블리 AllowPartiallyTrustedCallersAttribute을 추가함으로써이 문제를 해결 config 섹션을 deserialize하는 데 사용되는 유형.