springframework .NET 4.0控制台应用程序来自Intranet共享 -- .net-4.0 领域 和 console-application 领域 和 spring.net 领域 和 trust 领域 相关 的问题

Springframework .NET 4.0 console application from a intranet share


1
vote

问题

中文

我最近迁移了一个.NET 3.5控制台应用程序,它使用Spring和Nibierate到.NET 4.0。此应用程序在.NET 3.5下的网络共享中耗尽.NET 4.0下的本地驱动器关闭。但是,在.NET 4.0迁移到.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:ToolsSaaSDataPosterSaaSDataPoster.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:_prjspring-        net runksrcSpringSpring.CoreContextSupportContextRegistry.cs:line 60        --- End of inner exception stack trace ---        at Spring.Context.Support.ContextRegistry.GetContext()   

我已经尝试了添加 <NetFx40_LegacySecurityPolicy enabled="true" /> ,并使用 CasPol.exe 给出Intranet区全额信任(这在应用程序是.NET 2.0时)。

我也使用了为.NET 4.0编译的Spring.NET二进制文件。

我的装配器也有一个很好的名字。我不确定这是否有帮助或伤害。

"[BrokerPool] Failed to connect to seed broker, trying another broker from the list: Closed connection" 0 我的执行程序装配的属性也返回true。

有没有人与春天,净4.0和网络股份有任何运气?

以下是 "[BrokerPool] Failed to connect to seed broker, trying another broker from the list: Closed connection" 1 :的输出

32位:

  "[BrokerPool] Failed to connect to seed broker, trying another broker from the list: Closed connection" 2  

64位:

  "[BrokerPool] Failed to connect to seed broker, trying another broker from the list: Closed connection" 3  
英文原文

I've recently migrated a .NET 3.5 console application, which uses spring and nhiberate to .NET 4.0. This application ran fine off of network shares under .net 3.5 and off of a local drive under .net 4.0, however once I migrated it to .net 4.0, I get the following error at startup from a network share:

    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() 

I've tried adding <NetFx40_LegacySecurityPolicy enabled="true" /> and using CasPol.exe to give the intranet zone full trust (This worked when the app was .net 2.0).

I'm using the spring.net binaries that are compiled for .net 4.0 as well.

My assemblies all have a strong name as well. I'm not sure if that helps or hurts.

The IsFullTrusted property of my executing assembly returns true as well.

Has anyone had any luck with spring, net 4.0, and network shares?

Below is the output from caspol -m -lg:

32-bit:

    Code Groups:      1.  All code: Nothing        1.1.  Zone - MyComputer: FullTrust           1.1.1.  StrongName - 002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293: 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-bit:

    Code Groups:      1.  All code: Nothing        1.1.  Zone - MyComputer: FullTrust           1.1.1.  StrongName - 002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293: 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
 
vote

我通过向包含用于将配置部分进行反序列化的类型的组件添加allowpartiallytrustiedcallersAttribute来部分解决此问题。

 

I partially solved this problem by adding AllowPartiallyTrustedCallersAttribute to the assemblies containing the types used to deserialize the config sections.

 
 

相关问题

0  listview与复选框和可编辑字段?  ( Listview with checkboxes and editable fields ) 
我有一个listview表单,如下所示: 如何使其成为一个,所以每个单元格就像一个可编辑的文本框,所以用户可以通过单击单元格编辑值?就像他们单击"count" 文本编辑光标应该出现,它们应该能够键入以更改字段的值(不在单独的对话框或文本字段中) ...

1  究竟是自动注入func <t>的步骤是什么?  ( What exactly are the steps to auto inject funct ) 
我正在尝试设置一个服务类,在那里我想在其构造函数中注入一个简单的 Func<OtherService> 工厂方法。 type OtherService 是一个类,应该是自我限制的(确实在没有工厂注射的时)。 我安装了最新的ninject核心,indject.extensions.factory nuget包。当我尝...

1  如何使用“服务参考”从控制台应用程序调用具有表单身份验证的SharePoint Web服务  ( How to call sharepoint web services with forms authentication from a console app ) 
我的问题有点相关,这里的帖子访问SharePoint内容(列表)来自WCF服务 基本上,我知道如何获取使用.NET 2.0"Web参考" 的Web服务调用,因为我找到的大多数示例都是基于此。例如,请参阅 http: //social.msdn.microsoft.com/forums/en-us/sharepino...

87  .NET 4.0和.NET 4.5在.NET中的高级差异  ( Differences between net 4 0 and net 4 5 in high level in net ) 
渴望在.NET中高级中的.NET 4.0和.NET 4.5之间的差异。在这些框架中也在asp.net中的差异,C#也在这些框架中 ...

1  没有字典的快速多关键查找?  ( Fast multi key lookup without dictionary ) 
我有一个映射缓存,它占用了太多的内存。它用于容纳3种不同类型的ID的ID的组合,并从表中读取它们的映射,并在6个不同的字典中缓存,用于从任何1个ID类型到另一个id类型的快速查找/翻译(性能对我的申请很重要)。 我想将它重写为具有较小内存占用空间的东西,因此我确实实现了一个综合的ID列表并使用了LINQ / Lamb...

3  如何更改事件处理程序在继承的类中工作的方式?  ( How would i change the way the event handler works in an inherited class ) 
我正在使用自定义类,并有一个事件处理程序来观看属性,只在特定情况下反应。 以下是来自基类的片段: public class PageView { private UIView activePage; public List<UIView> Pages { get; set; } publi...

0  模拟C#中的等待句柄?  ( Simulating wait handles in c ) 
我们可以使用 Wait 和 Pulse 来模拟 ManualResetEvent ,如下所示: 代码#1 readonly object _locker = new object(); bool _signal; void WaitOne() { lock (_locker) { whi...

0  在模板中讨论枚举类型  ( Foreach on enum types in template ) 
enum MyEnum { type1, type2, type3 } public void MyMethod<T>() { ... } 如何将FORACH on Enum发射 MyMethod<T>(每枚枚举)(每个enum)? 我尝试用 foreach (MyEnum type in Enum....

0  通过附加到进程VS2010中的CPU采样?  ( Cpu sampling in vs2010 via attach to process ) 
是可以通过附加到处理选项在VS2010中执行CPU采样?当我使用该选项时,它似乎总是默认到内存分析。我无法使用向导启动CPU采样,因为我们工作PC上的荒谬的安全软件不允许使用它使用的DLL注入。 ...

1  并行。递归方法的foreach  ( Parallel foreach in recursive method ) 
我有一种方法,可以收集与数据库的共享信息和写入结果, 我使用并行.Foreach,提高性能,特别是如果扫描100 TB 如果我在本地数据库中运行此代码,我没有问题,但在沙箱数据库上我得到了几吨例外/ InnerExceptions 代码: private static INodeCollection Node...

12  构建错误:“表达式太长或复杂,以编译”  ( Build error an expression is too long or complex to compile ) 
每个现在,当我构建一个特定的解决方案时,我会在错误列表窗口中获得随机量的"表达式太长或复杂" 。但是,错误点唯一的项目是特定项目,而不是项目中的文件或特定位置。 当我遇到这个时,我'干净'然后我重新启动vs,似乎修复它。关于导致此内容的任何想法? 这个特定的解决方案有50个项目。 ...

1  从4.5到4.0:命名空间'Microsoft'中的类型或命名空间名称'aspnet'不存在  ( From 4 5 to 4 0 the type or namespace name aspnet does not exist in the names ) 
我正在工作.NET 4.5使用的信号R 1.1.2,一切都正常工作。 然后我们希望将NetFrameWork的版本降低到4.0 COS的生产服务器,一切都停止并出现此错误。请告诉我该怎么办? The type or namespace name 'AspNet' does not exist in the nam...

3  LINQ表达式优化语法?  ( Linq expression to optimize syntax ) 
foreach (var item in mainCanvas.Children) { if (item is Button) { (item as Button).Content = "this is a button"; } } 我...

0  RESTful Service和用户角色授权  ( Restful service and user role authorization ) 
我们为我们的客户创建了一个RESTful Web API,它将被他们的本地移动应用程序和Web应用程序消耗没有第三方访问。 每个用户在应用程序中有自己的凭据和角色,以及基于角色的访问AKA授权。 在没有保留会话的情况下在Web API中验证和角色授权的最佳方法是什么。我正在使用ASP.NET Web API 1.0,...

3  身份,WIF,SAML和第三方IDP  ( Identity wif saml and a 3rd party idp ) 
我们试图让Intranet站点用于与我们内部广告联合的第三方外部ID提供商(OKTA)工作。 我们设法使用终极SAML来解析返回该网站的SAML令牌,但正在查看其他选项,如WIF和Thinkture.IdtiftityModel。 我一直在尝试使用MVC 4 / .NET 4 / .NET 4 / CONTRESS ...




© 2021 it.wenda123.org All Rights Reserved. 问答之家 版权所有