Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

CRM 2016 (On-prem) - SharePoint 2016 (On-prem) integration: Invalid site

Posted on by 35

Hi!

I am setting up a server-based SharePoint Integration on our DEV environment. I have followed the instructions on https://technet.microsoft.com/en-us/library/dn949332.aspx and everything seems to be in perfect order until I launch the "Enable Server-Based SharePoint Integration" wizard from CRM. After checking the "On-Premises" --> Next --> Providing the site URL (https://<FQDN>/sites/crmdev) and SharePoint realm ID --> Next..

Here it all comes to a screeching halt:

unexpectederror.png

sbierror.png

On the CRM server I get a 18176 error containing the following:

The Web Service plug-in failed in OrganizationId: 00e5d762-6caf-48e7-9331-4d96b31b7c84; SdkMessageProcessingStepId: e0bdf6d6-0b83-4aba-838f-f7b4a31afd72; EntityName: sharepointdocument; Stage: 30; MessageName: ValidateSharePointSite; AssemblyName: Microsoft.Crm.Extensibility.InternalOperationPlugin, Microsoft.Crm.ObjectModel, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35; ClassName: Microsoft.Crm.Extensibility.InternalOperationPlugin; Exception: Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Web.Services.Protocols.LogicalMethodInfo.Invoke(Object target, Object[] values)
   at Microsoft.Crm.Extensibility.InternalOperationPlugin.Execute(IServiceProvider serviceProvider)
   at Microsoft.Crm.Extensibility.V5PluginProxyStep.ExecuteInternal(PipelineExecutionContext context)
   at Microsoft.Crm.Extensibility.VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)
Inner Exception: System.Xml.XmlException: An error occurred while parsing EntityName. Line 7, position 171.
   at System.Xml.XmlTextReaderImpl.Throw(Exception e)
   at System.Xml.XmlTextReaderImpl.HandleEntityReference(Boolean isInAttributeValue, EntityExpandType expandType, Int32& charRefEndPos)
   at System.Xml.XmlTextReaderImpl.ParseText(Int32& startPos, Int32& endPos, Int32& outOrChars)
   at System.Xml.XmlTextReaderImpl.FinishPartialValue()
   at System.Xml.XmlTextReaderImpl.get_Value()
   at System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r)
   at System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r, LoadOptions o)
   at System.Xml.Linq.XElement.ReadElementFrom(XmlReader r, LoadOptions o)
   at System.Xml.Linq.XElement.Load(XmlReader reader, LoadOptions options)
   at System.Xml.Linq.XElement.Parse(String text, LoadOptions options)
   at Microsoft.Crm.ObjectModel.SharePointProxyBase.ValidateSharePointSite(String[] siteUrls, String& validationLog)
   at Microsoft.Crm.ObjectModel.SharePointProxyService.ValidateSharePointSite(String[] siteUrls, ExecutionContext context, String& validationLog)
.

There is also a windows error reporting event, containing the following log info:

Exception generated at: 18.11.2016 08:44:20
Error Type: System.Xml.XmlException
Error Message: An error occurred while parsing EntityName. Line 7, position 171.
Error Stack Trace: 
	at XmlTextReaderImpl.Throw(Exception e)  ilOffset = 0x27
	at XmlTextReaderImpl.HandleEntityReference(Boolean isInAttributeValue, EntityExpandType expandType, Int32& charRefEndPos)  ilOffset = 0xB5
	at XmlTextReaderImpl.ParseText(Int32& startPos, Int32& endPos, Int32& outOrChars)  ilOffset = 0x1D0
	at XmlTextReaderImpl.FinishPartialValue()  ilOffset = 0x36
	at XmlTextReaderImpl.get_Value()  ilOffset = 0x1A
	at XContainer.ReadContentFrom(XmlReader r)  ilOffset = 0x132
	at XContainer.ReadContentFrom(XmlReader r, LoadOptions o)  ilOffset = 0x354
	at XElement.ReadElementFrom(XmlReader r, LoadOptions o)  ilOffset = 0x106
	at XElement.Load(XmlReader reader, LoadOptions options)  ilOffset = 0x4C
	at XElement.Parse(String text, LoadOptions options)  ilOffset = 0x16
	at SharePointProxyBase.ValidateSharePointSite(String[] siteUrls, String& validationLog)  ilOffset = 0x6E2
	at SharePointProxyService.ValidateSharePointSite(String[] siteUrls, ExecutionContext context, String& validationLog)  ilOffset = 0xF5


Stack Frame: 

	at Pipeline.Execute(PipelineExecutionContext context)  ilOffset = 0xDD
	at MessageProcessor.Execute(PipelineExecutionContext context)  ilOffset = 0x1EB
	at InternalMessageDispatcher.Execute(PipelineExecutionContext context)  ilOffset = 0xE4
	at ExternalMessageDispatcher.ExecuteInternal(IInProcessOrganizationServiceFactory serviceFactory, IPlatformMessageDispatcherFactory dispatcherFactory, String messageName, String requestName, Int32 primaryObjectTypeCode, Int32 secondaryObjectTypeCode, ParameterCollection fields, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId, Guid callerRegardingObjectId, UserType userType, Guid transactionContextId, Int32 invocationSource, Nullable`1 requestId, Version endpointVersion)  ilOffset = 0x22D
	at ExternalMessageDispatcher.Execute(IInProcessOrganizationServiceFactory serviceFactory, IPlatformMessageDispatcherFactory dispatcherFactory, String messageName, String requestName, Int32 primaryObjectTypeCode, Int32 secondaryObjectTypeCode, ParameterCollection fields, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId, Guid callerRegardingObjectId, UserType userType, Guid transactionContextId, Int32 invocationSource, Nullable`1 requestId)  ilOffset = 0x0
	at OrganizationSdkServiceInternal.ExecuteRequestRequestWithInstrumentation(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType, UserAuth userAuth, Guid targetUserId, OrganizationContext context, Boolean returnResponse, Boolean checkAdminMode, Object operation, UserType targetUserType)  ilOffset = 0x0
	at OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType, Boolean checkAdminMode, ExecutionContext executionContext)  ilOffset = 0x4B
	at OrganizationSdkServiceInternal.Execute(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType, Boolean checkAdminMode, ExecutionContext executionContext)  ilOffset = 0x0
	at InprocessServiceProxy.ExecuteCore(OrganizationRequest request)  ilOffset = 0x34
	at SandboxSdkListener.ExecuteInternal(SandboxCallInfo callInfo, SandboxSdkContext requestContext, String operation, Byte[] serializedRequest, IExecutionContext context, String& primaryEntityName)  ilOffset = 0xDA
	at SandboxSdkListener.Execute(SandboxCallInfo callInfo, SandboxSdkContext requestContext, String operation, Byte[] serializedRequest)  ilOffset = 0xC3
	at   ilOffset = 0xFFFFFFFF
	at SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)  ilOffset = 0x222
	at DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)  ilOffset = 0x97
	at ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)  ilOffset = 0x48
	at MessageRpc.Process(Boolean isOperationContextSet)  ilOffset = 0x65
	at Wrapper.Resume(Boolean& alreadyResumedNoLock)  ilOffset = 0x1B
	at ThreadBehavior.ResumeProcessing(IResumeMessageRpc resume)  ilOffset = 0x8
	at ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)  ilOffset = 0x79
	at ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)  ilOffset = 0x9
	at QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()  ilOffset = 0x35
	at ThreadPoolWorkQueue.Dispatch()  ilOffset = 0xA4


Exception Data: 
	1: Key type: System.String, value: PluginTrace

Custom Message: Web Service Plug-in failed in SdkMessageProcessingStepId: e0bdf6d6-0b83-4aba-838f-f7b4a31afd72; EntityName: sharepointdocument; Stage: 30; MessageName: ValidateSharePointSite; AssemblyName: Microsoft.Crm.Extensibility.InternalOperationPlugin, Microsoft.Crm.ObjectModel, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35; ClassName: Microsoft.Crm.Extensibility.InternalOperationPlugin; Exception: Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Web.Services.Protocols.LogicalMethodInfo.Invoke(Object target, Object[] values)
   at Microsoft.Crm.Extensibility.InternalOperationPlugin.Execute(IServiceProvider serviceProvider)
   at Microsoft.Crm.Extensibility.V5PluginProxyStep.ExecuteInternal(PipelineExecutionContext context)
   at Microsoft.Crm.Extensibility.VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)
Inner Exception: System.Xml.XmlException: An error occurred while parsing EntityName. Line 7, position 171.
   at System.Xml.XmlTextReaderImpl.Throw(Exception e)
   at System.Xml.XmlTextReaderImpl.HandleEntityReference(Boolean isInAttributeValue, EntityExpandType expandType, Int32& charRefEndPos)
   at System.Xml.XmlTextReaderImpl.ParseText(Int32& startPos, Int32& endPos, Int32& outOrChars)
   at System.Xml.XmlTextReaderImpl.FinishPartialValue()
   at System.Xml.XmlTextReaderImpl.get_Value()
   at System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r)
   at System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r, LoadOptions o)
   at System.Xml.Linq.XElement.ReadElementFrom(XmlReader r, LoadOptions o)
   at System.Xml.Linq.XElement.Load(XmlReader reader, LoadOptions options)
   at System.Xml.Linq.XElement.Parse(String text, LoadOptions options)
   at Microsoft.Crm.ObjectModel.SharePointProxyBase.ValidateSharePointSite(String[] siteUrls, String& validationLog)
   at Microsoft.Crm.ObjectModel.SharePointProxyService.ValidateSharePointSite(String[] siteUrls, ExecutionContext context, String& validationLog)
.

My user is CRM Administrator, local admin on both CRM and Sharepoint servers, and SharePoint Farm Administrator. Certificates are issues by our local CA.

I can't get a grasp of exactly WHAT is failing, and where to start looking. If I manually add a SharePoint site in CRM, and run validation it validates. However it will not validate through the SBI wizard..

Any takers? :)

*This post is locked for comments

  • werdnA Profile Picture
    werdnA 55 on at
    RE: CRM 2016 (On-prem) - SharePoint 2016 (On-prem) integration: Invalid site

    Hi Glenn,

    Sorry, one other question for you!

    You said "Lastly I removed SPAppPrincipal, SPClaimTypeMapping, SPAppPrincipalPermission and SPTrustedSecurityTokenIssuer from SharePoint"

    Do you remember what commands you used?

    I can remove the SPAppPrincipalPermission and SPTrustedSecurityTokenIssuer using these commands:

    $site = Get-SPSite "https://sharepoint"
    
    $appPrincipal = Get-SPAppPrincipal -NameIdentifier '00000007-0000-0000-c000-000000000000@'+$CrmRealmId -Site $site.RootWeb
    
    Remove-SPAppPrincipalPermission -AppPrincipal $appPrincipal -Site $site.RootWeb -scope "SiteCollection"
    
    Remove-SPTrustedSecurityTokenIssuer -Identity "crm"

    Did you do anything else? Thanks.

  • werdnA Profile Picture
    werdnA 55 on at
    RE: CRM 2016 (On-prem) - SharePoint 2016 (On-prem) integration: Invalid site

    Hi Glenn,

    Glad you managed to get it working! I tried to replicate your steps in case it might help with my problem:

    community.dynamics.com/.../220822

    My private key provider was initially "Microsoft RSA SChannel Cryptographic Provider" which I then converted to "Microsoft Enhanced Cryptographic Provider v1.0" following your instructions.

    I went through CertificateReconfiguration.ps1  line by line but in my case "$sslCertPrivKey = $sslCert.PrivateKey" seemed to be working ok.

    Sadly I'm still stuck with a 401 error on validation but I will keep trying! Thanks for the ideas.

  • Verified answer
    glennrlie Profile Picture
    glennrlie 35 on at
    RE: CRM 2016 (On-prem) - SharePoint 2016 (On-prem) integration: Invalid site

    Hi!

    After sitting for hours today trying to figure this problem out, I finally managed to set up the integration. As there was a lot of trial and errors, I haven't 100% confirmed the solution, but I am pretty sure it has to do with provider types.

    First, I examined the trace files in CRM, and what I found was this:

    Inner Exception: System.InvalidOperationException: IDX10614: AsymmetricSecurityKey.GetSignatureFormater( 'www.w3.org/.../xmldsig-more' ) threw an exception.
    Key: 'System.IdentityModel.Tokens.X509AsymmetricSecurityKey'
    SignatureAlgorithm: 'www.w3.org/.../xmldsig-more', check to make sure the SignatureAlgorithm is supported.
    Exception:'System.Security.Cryptography.CryptographicException: Invalid provider type specified.


     In addition, the following line in CertificateReconfiguration.ps1 returned null:

    $sslCertPrivKey = $sslCert.PrivateKey 


    The certificate's private key could not be read, even though it was clearly present when I examined the imported certificate. This led me on to a Google search, and I found this blog:

    http://blog.davidchristiansen.com/2016/05/521/

    David explains difficulties with storage providers. I did a check on my certificate by running:

    certutil -dump C:\temp\<my certificate>.pfx


    Provider was set to "Microsoft Software Key Storage Provider", which is obviously a CNG Key Storage Provider (msdn.microsoft.com/.../bb931355(v=vs.85).aspx). Following David's instructions I converted my certificate key from CNG to RSA using OpenSSL. Running the certutil command on the new certificate returned "Microsoft Enhanced Cryptographic Provider v1.0" as provider.

    I then imported the new, converted certificate and ran the CertificateReconfiguration.ps1 script. Lastly I removed SPAppPrincipal, SPClaimTypeMapping, SPAppPrincipalPermission and SPTrustedSecurityTokenIssuer from SharePoint, and set it up from scratch (as described in the section Prepare the SharePoint farm for server-based integration on https://technet.microsoft.com/en-us/library/dn949332.aspx).

    After this was done I did an IISRESET and navigated to my CRM. Running the wizard now validated the SharePoint site, and I was able to configure document management.

    Happy camper, now soon moving on to (hopefully) set up the integration in our TEST environment without too many issues..

    EDIT: After googling CRM and CNG I found this document:

    https://www.microsoft.com/en-us/download/confirmation.aspx?id=41701

    It clearly states:

    If you use a certificate that is created by using a custom certificate request, the template that was used must be the Legacy key template. Custom certificate requests created by using the CNG key template are incompatible with Microsoft Dynamics CRM.

     

    ..if only MS had written those lines in their SharePoint/CRM guide as well....

     

  • werdnA Profile Picture
    werdnA 55 on at
    RE: CRM 2016 (On-prem) - SharePoint 2016 (On-prem) integration: Invalid site

    I was able to get past the problem by examining the results of a trace (see support.microsoft.com/.../907490 for instructions)

    In my case I found a 'Keyset does not exist' error which went away when I gave the CRM app pool service account read permissions to the certificate private key, I think maybe the wrong account was used for CertificateReconfiguration.ps1

    Now facing Failed Authentication.

  • glennrlie Profile Picture
    glennrlie 35 on at
    RE: CRM 2016 (On-prem) - SharePoint 2016 (On-prem) integration: Invalid site

    Sorry to say, nothing yet... As this is a dev environment I haven't put too much effort in it either. I'll keep you posted if I can sort this out.

  • werdnA Profile Picture
    werdnA 55 on at
    RE: CRM 2016 (On-prem) - SharePoint 2016 (On-prem) integration: Invalid site

    did you make any progress Glenn? I'm facing the same problem.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans