使用SharePoint Designer创建了一个外部内容类型external content type,连接SQL Server数据库中的一个表。然后在管理中心配置了权限,再使用这个external content type创建了一个外部列表external list,打开list的时候出现如下错误:
出现这个问题一般有两个可能的原因,第一个是因为数据库表中的数据太多,超过了throttle限制,解决办法是关掉threshold的限制,可以使用如下powershell来关掉:
1. 获取BDC代理:
$bdcProxy = Get-SPServiceApplicationProxy | where {$_.TypeName -eq ‘Business Data Connectivity Application Service Proxy’
其中“Business Data Connectivity Application Servcie Proxy”是BDC代理在管理中心中的名字。
2. 获取Throttle配置:
$dbRule = Get-SPBusinessDataCatalogThrottleConfig -Scope Database -ThrottleType Items -ServiceApplicationProxy $bdcProxy
3. 关闭throttle限制
Set-SPBusinessDataCatalogThrottleConfig -Identity $dbRule -Enforced:$false
第二个可能的原因是用户的权限配置不对,在使用designer创建external content type的时候,默认指定的账户是SharePoint用户的账户,这种情况下不同的登录用户,访问external content type的权限不同。也可以指定使用BDC application pool的账户,统一使用application pool账户来访问外部数据源,设置如下:
在保存的时候,会出现一个错误信息:
通过以下powershell可以解决这个问题:
$bcsServiceApp = Get-SPServiceApplication | where {$_ -match "Business Data Connectivity Service"}
$bcsServiceApp.RevertToSelfAllowed = $true;
$bcsServiceApp.Update();
这样的话就不会有权限的问题了。