I'm getting below error in this code:
var cfg = new XConnectClientConfiguration(
new XdbRuntimeModel(CollectionModel.Model), collectionClient, searchClient, configurationClient);
in below method to establish connection to xConnect.
- TypeInitializationException: The type initializer for '
Sitecore.XConnect.Schema.XConnectCoreModel
' threw an exception. - System.TypeInitializationException: 'The type initializer for '
Sitecore.XConnect.Collection.Model.CollectionModel
' threw an exception.' - FileNotFoundException: Could not load file or assembly '
System.Interactive.Async.Providers
, Version=3.0.0.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263' or one of its dependencies. The system cannot find the file specified.
public virtual XConnectClientConfiguration GetClientConfiguration(string collectionHost, string searchHost, string configHost, string thumbprint)
{
//Set up the certificate used to connect to xConnect endpoints
var options = CertificateHttpClientHandlerModifierOptions.Parse("StoreName=My;StoreLocation=LocalMachine;FindType=FindByThumbprint;FindValue=" + thumbprint);
var certificateModifier = new CertificateHttpClientHandlerModifier(options);
//Set up timeout modifier for the client
var timeoutClientModifier = new TimeoutHttpClientModifier(new TimeSpan(0, 0, 20));
var clientModifiers = new List<IHttpClientModifier>
{
timeoutClientModifier
};
//Initialize the clients. Each requires the certificate in order to open the connection
var collectionClient = new CollectionWebApiClient(new Uri(collectionHost + "/odata"), clientModifiers, new[] { certificateModifier });
var searchClient = new SearchWebApiClient(new Uri(searchHost + "/odata"), clientModifiers, new[] { certificateModifier });
var configurationClient = new ConfigurationWebApiClient(new Uri(configHost + "/configuration"), clientModifiers, new[] { certificateModifier });
//Create the configuration object with all clients
var cfg = new XConnectClientConfiguration(
new XdbRuntimeModel(CollectionModel.Model), collectionClient, searchClient, configurationClient);
return cfg;
}