Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/solr/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
字典中不存在给定的密钥。-异常Solrnet和CommonServicelocator_Solr_Sitecore_Solrnet_Service Locator_Common Service Locator - Fatal编程技术网

字典中不存在给定的密钥。-异常Solrnet和CommonServicelocator

字典中不存在给定的密钥。-异常Solrnet和CommonServicelocator,solr,sitecore,solrnet,service-locator,common-service-locator,Solr,Sitecore,Solrnet,Service Locator,Common Service Locator,我们在Sitecore CMS中使用SolrNet,它在Solr上也有一个包装器。但为了充分利用SolrNet的功能,我们更倾向于使用SolrNet 我已经升级了这个sitecore应用程序,看起来它还为Solr初始化了ServiceLocator。这与Solrnet ServiceLocator冲突。下面是我们用于初始化Solrnet的代码和错误堆栈跟踪。我不确定如何调试或解决此错误,请任何人为此提供一些指针,或者以前见过此错误 Startup.Init(loggingSolrConnecti

我们在Sitecore CMS中使用SolrNet,它在Solr上也有一个包装器。但为了充分利用SolrNet的功能,我们更倾向于使用SolrNet

我已经升级了这个sitecore应用程序,看起来它还为Solr初始化了ServiceLocator。这与Solrnet ServiceLocator冲突。下面是我们用于初始化Solrnet的代码和错误堆栈跟踪。我不确定如何调试或解决此错误,请任何人为此提供一些指针,或者以前见过此错误

Startup.Init(loggingSolrConnection)

Solrnet版本-1.0.13,也尝试了最新的1.0.19。Bin文件夹包含-Commonservicelocator.dllCommonservicelocator.solrnet.dll

The given key was not present in the dictionary.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:
[KeyNotFoundException: The given key was not present in the dictionary.]
   System.ThrowHelper.ThrowKeyNotFoundException() +36
   System.Collections.Generic.Dictionary`2.get_Item(TKey key) +52
   SolrNet.Utils.Container.DoGetInstance(Type serviceType, String key) +25
   CommonServiceLocator.ServiceLocatorImplBase.GetInstance(Type serviceType, String key) +54

[ActivationException: Activation error occurred while trying to get instance of type ISolrMoreLikeThisHandlerQueryResultsParser`1, key ""]
   CommonServiceLocator.ServiceLocatorImplBase.GetInstance(Type serviceType, String key) +155
   CommonServiceLocator.ServiceLocatorImplBase.GetInstance() +54

Sitecore旨在从开发者那里抽象出搜索引擎实现,这样Solr/Azure search/Elastic search/Coveo/(任何其他引擎)都可以在幕后使用

尽管此错误表明缺少应通过
Sitecore.ContentSearch.SolrProvider.SolrNetIntegration.DefaultSolrLocator.Initialize
或通过
SolrNet.Startup.InitContainer
API添加到OOB Sitecore的
IsorMorRelieketHisHandlerQueryResultsParser
注册,我鼓励您避免直接与SOLR打交道并使用

否则,您可能会遇到由于绕过Sitecore逻辑而导致的不同行为


当OOB Sitecore API不够时,请您简要说明原因/用例好吗?

Hi@Nikolay,这是从Sitecore 8.x版本继承的应用程序代码库,现在正在升级到Sitecore 9.2,我相信SolrNet的使用是为了利用一些功能,例如(POST请求而不是GET)无法从Sitecore.ContentSearch获得的OOTB。另外,我想补充一点,SolrNet在Sitecore 8.x应用程序中运行得非常好。