Saturday, September 20, 2014

Error while executing web part: Microsoft.BusinessData.Infrastructure.BdcException

Error Information:

Error while executing web part: Microsoft.BusinessData.Infrastructure.BdcException: The shim execution failed unexpectedly - Assembly was requested for LobSystem with Name 'My.BCS.ReferenceData', but this assembly was not returned. SystemUtility of Type 'Microsoft.SharePoint.BusinessData.SystemSpecific.DotNetAssembly.DotNetAssemblySystemUtility' requires the assembly to be uploaded.. ---> System.InvalidOperationException: Assembly was requested for LobSystem with Name 'My.BCS.ReferenceData', but this assembly was not returned. SystemUtility of Type 'Microsoft.SharePoint.BusinessData.SystemSpecific.DotNetAssembly.DotNetAssemblySystemUtility' .............................
Microsoft.SharePoint.SPListItemCollection.EnsureEntityDataViewAndOrdering(String& bdcidFirstRow, String& bdcidNextPageFirstRow)     at Microsoft.SharePoint.SPListItemCollection.EnsureListItemsData()     at Microsoft.SharePoint.SPListItemCollection.get_Count()     at Microsoft.SharePoint.WebControls.SPDataSourceView.ExecuteSelect(DataSourceSelectArguments selectArguments, String aggregateString, Boolean wantReturn, BaseXsltListWebPart webpart, SPListItem& listItem, SPListItemCollection& listItems, String[]& fieldList)     at Microsoft.SharePoint.WebControls.SingleDataSource.GetXPathNavigatorInternal()     at Microsoft.SharePoint.WebControls.SingleDataSource.GetXPathNavigator()     at Microsoft.SharePoint.WebPartPages.DataFormWebPart.PrepareAndPerformTransform(Boolean bDeferExecuteTransform)



Solution:

Please execute the following script in your SharePoint machine (I think any web front end should be OK):
#Reference the dll from GAC the version and public token will be different for yours (highlighted below)
$assemblyPath = "C:\Windows\assembly\GAC_MSIL\My.BCS.ReferenceData\1.0.0.0__148de4c699ea2f41\My.BCS.ReferenceData.dll"
$lobSystem = "My.BCS.ReferenceData"
Write-Host "Adding assembly to LOBSystem"
$serviceContext = Get-SPServiceContext $url
$lobSystem = Get-SPBusinessDataCatalogMetadataObject -ServiceContext $serviceContext -BdcObjectType lobsystem -Name $lobSystem
Import-SPBusinessDataCatalogDotNetAssembly -LobSystem $lobSystem -Path $assemblyPath

Please note that the above script will promopt for IIS reset, please continue with yes "Y" option.

2 comments:

  1. Admiring the time and effort you put into your blog and detailed information you offer!.. SharePoint Intranet

    ReplyDelete

Access to XMLHttpRequest at 'from origin has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https. .net core angular

Issue: The angular application was getting error from API that the origin has been blocked by CORS policy. Solution: Make sure that the...