类型的权限已失败 SqlClientPermission
错误描述:
请求“System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089”类型的权限已失败。”
方法1:
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12|40|60\CONFIG\wss_minimaltrust.config
增加以下配置:
SecurityClasses下增加:
<SecurityClass Name="SqlClientPermission" Description="System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
NamedPermissionSets下增加:
<PermissionSet class="System.Security.NamedPermissionSet" version="1" Name="CustomLocalIntranet" Description="Custom permission set given to applications on the local intranet">
<IPermission class="System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" AllowBlankPassword="False">
<add ConnectionString="Data Source=(local);Integrated Security=true;" KeyRestrictions="Initial Catalog=;Connection Timeout=; Encrypt=;Packet Size=;" KeyRestrictionBehavior="AllowOnly" />
</IPermission>
</PermissionSet>
或: <IPermission class="SqlClientPermission"
version="1"
Unrestricted="true"
/>
方法2:
Web.config:
<trust level="Full" originUrl="" />
http://blog.csdn.net/qq546937127/archive/2009/06/29/4305677.aspx
方法1为测试通过,方法二通过