2011-12-24 93 views
0

当Net版本不是Net4时,我的应用程序运行得非常漂亮。如果我从头开始创建一个新的基于Windows 7的服务器,它会继续完美地工作。配置权限并远离你。Csla4和Net4 - 在客户端拒绝ASPNET权限

但是(并且总是有一个但是...),我的客户有一个现有的服务器,当我移动到Csla4和Net4时,应用程序甚至无法启动。所有权限在我的“干净”服务器和他的“传统但升级”服务器上似乎是相同的。但是,客户端获得一个安全错误:

System.Security.SecurityException: Request failed. 
    at System.RuntimeMethodHandle.PerformSecurityCheck(Object obj, RuntimeMethodHandleInternal method, RuntimeType parent, UInt32 invocationFlags) 
    at System.RuntimeMethodHandle.PerformSecurityCheck(Object obj, IRuntimeMethodInfo method, RuntimeType parent, UInt32 invocationFlags) 
    at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) 
    at System.Reflection.ConstructorInfo.Invoke(Object[] parameters) 
    at System.Configuration.TypeUtil.InvokeCtorWithReflectionPermission(ConstructorInfo ctor) 
    at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.CreateSectionImpl(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader) 
    at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.CreateSectionWithRestrictedPermissions(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader) 
    at System.Configuration.RuntimeConfigurationRecord.CreateSection(Boolean inputIsTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader) 
    at System.Configuration.BaseConfigurationRecord.CallCreateSection(Boolean inputIsTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader, String filename, Int32 line) 
The action that failed was: 
Demand 
The type of the first permission that failed was: 
System.Security.PermissionSet 
The demand was for: 
<PermissionSet class="System.Security.PermissionSet" 
version="1" 
Unrestricted="true"/> 

The only permitted permissions were: 
<PermissionSet class="System.Security.NamedPermissionSet" 
version="1" 
Name="Internet" 
Description="Default rights given to Internet applications"> 
<IPermission class="System.Security.Permissions.FileDialogPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" 
version="1" 
Access="Open"/> 
<IPermission class="System.Security.Permissions.IsolatedStorageFilePermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" 
version="1" 
Allowed="ApplicationIsolationByUser" 
UserQuota="1024000"/> 
<IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" 
version="1" 
Flags="Execution"/> 
<IPermission class="System.Security.Permissions.UIPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" 
version="1" 
Window="SafeTopLevelWindows" 
Clipboard="OwnClipboard"/> 
<IPermission class="System.Drawing.Printing.PrintingPermission, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 
version="1" 
Level="SafePrinting"/> 
<IPermission class="System.Security.Permissions.MediaPermission, WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" 
version="1" 
Audio="SafeAudio" 
Video="SafeVideo" 
Image="SafeImage"/> 
<IPermission class="System.Security.Permissions.WebBrowserPermission, WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" 
version="1" 
Level="Safe"/> 
</PermissionSet> 

The method that caused the failure was: 
System.Object CreateSectionWithRestrictedPermissions(System.Configuration.RuntimeConfigurationRecord, System.Configuration.FactoryRecord, System.Configuration.SectionRecord, System.Object, System.Configuration.ConfigXmlReader) 

我学习的NET4的更改ASPNET安全,并感到困惑看一遍。

有没有其他人遇到过这个问题,并可以指出我在正确的方向吗?重复一遍,该应用程序在我从头开始创建的远程环境中完美工作,而不是在更新的旧版服务器中。

回答

0

我认为服务器配置为“中等信任”在web.config左右。据我所知,CSLA需要“完全信任”来克隆业务对象。

如果这不是问题ü可以尝试将服务器添加到Windows registory客户的信任区域下

[HKEY_CURRENT_USER \软件\微软\的Windows \ CurrentVersion \ Internet设置\ ZoneMap]

欲了解更多信息,你可以浏览到http://blogs.technet.com/b/heyscriptingguy/archive/2005/05/02/how-can-i-add-a-site-to-internet-explorer-s-restricted-sites-zone.aspx