Friday, November 17, 2017

Sitecore 9 QuickStarts - Getting Started With xConnect

The best place to get started with XConnect is using Martina's documentation. It walks you through your basic XConnect console application.

Once you have this console app building start taking a look at the Jason Wilkerson blog articles on XConnect. Although tempting, do NOT start with Jason's articles. It is important that you get Martina's application working first and then start adding functionality from Jason's articles. The reason is that Martina's will do all the client certificate stuff properly and that is what you want for production.

I started myself with this console app and am now using Jason's blog articles myself.  My hope is to build out a repository on GitHub along with a series of articles on how to integrate XConnect with a variety of other applications in hopes this will save others time doing this.  If you are building an integration maybe we can collaborate and then add it to the repository for others to use.

When you create your project in Visual Studio 2017, if it defaults to creating your console app as 4.6.1 and you switch to 4.6.2 you may get an error about the root node.  If you do it is a bug in the conversion.  Check your app.config file and make sure it is formatted like this.  In my case it removed the configuration node and put startup within appSettings.

<?xml version="1.0" encoding="utf-8"?>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/>
    <add key="xConnectCertificateThumbprint" value="082FF77F7C87A93A3C5FE88CFB3DAB730DEF331A"/>

If you do not see the 4.6.2 option in Visual Studio 2017 then you need to install the developer pack


The error you may run into and in fact I did is, "Sitecore.XConnect.XdbCollectionUnavailableException: 'The HTTP response was not successful: Unauthorized' The StackExchange mentions these 3 causes:

  1. Your thumbprint or certificate is not properly installed so you are being blocked from connecting to xConnect
  2. Your application does not have access to the certificate (e.g. IIS user does not have permission)
  3. You did not execute the script in the installation guide Post-installation steps.
On first install I had forgot to run the execution script, doh. The second time around it was the second one but it was a step further it was not the certificate itself but a policy applied to my laptop by IT that was not allowing the root authority because I was generating a self-signed certificate on my development environment. Hopefully this will help you when you run into this issue.

If you are running into issues with 401 or 403 errors connecting to xConnnect then this article can help you troubleshooting the certificate issues. It is all about xConnect Security

No comments:

Post a Comment