Getting error as "Key... already registered in container"

517 views
Skip to first unread message

Bhagwat Mane

unread,
Dec 17, 2015, 11:30:38 AM12/17/15
to SolrNet

Hi All,

I am getting error as "Key 'SolrNet.Impl.SolrConnection.SolrSearchResult.SolrNet.Impl.SolrConnection' already registered in container".

after searching on web, i found that we can resolve this issue by putting Startup.Init code in global.asax in web application and for windows in main() function.

Below are my points-
  1. We have created separate dll for solr code as we are using this component from multiple places.
  2. We have one more requirement that we need to change solr url at run time, as we are doing some operation at same time with multiple environments. and those environments have different solr servers.
  3. In our application we are doing some operations in multi threading and at that time this solr code get execute. some time we face above error with multi threading.

Please help me to resolve this error, how i can change url at runtime?


Thanks,


Bhagwat Mane

 
Untitled.png

Bhagwat Mane

unread,
Dec 17, 2015, 11:30:38 AM12/17/15
to SolrNet

Thank You.

Mauricio Scheffer

unread,
Dec 19, 2015, 1:14:27 AM12/19/15
to sol...@googlegroups.com
You could either:

- create a cache of ISolrOperations instances per URL (e.g. using ConcurrentDictionary) or 
- not use Startup.Init and instead create all the internal SolrNet objects yourself. You can use https://github.com/mausch/SolrNet/blob/master/SolrNet/Startup.cs as reference.





--
Mauricio

--
You received this message because you are subscribed to the Google Groups "SolrNet" group.
To unsubscribe from this group and stop receiving emails from it, send an email to solrnet+u...@googlegroups.com.
To post to this group, send email to sol...@googlegroups.com.
Visit this group at https://groups.google.com/group/solrnet.
For more options, visit https://groups.google.com/d/optout.

Ritesh Rai

unread,
Jun 9, 2017, 3:02:14 AM6/9/17
to SolrNet
Thanks for sharing your feedback on this.

In our case as mentioned above by Bhagwat , we are not using Dictionary for saving details so would not be able to use  ConcurrentDictionary.

For the second option, can you please elaborate more how can we create all the internal SolrNet objects ?

Thanks!

Ritesh Rai

unread,
Jun 12, 2017, 5:23:35 AM6/12/17
to SolrNet
Hi ,

Can you please help us on below request ?

Thanks,
Ritesh Rai

Hiresh Malviya

unread,
Jun 16, 2017, 4:55:18 AM6/16/17
to SolrNet
We are also facing same issue.

Could you please let us know how to use ConcurrentDictionary for creating cache of   ISolrOperations

Thanks,
Hiresh Kumar

Bhagwat Mane

unread,
Jun 20, 2017, 7:26:11 AM6/20/17
to SolrNet

Hi Mauricio,

It will be great if you provide my sample code to resolve this issue.

Awaiting for your valuable inputs.

Thanks,

Bhagwat Mane

Reply all
Reply to author
Forward
0 new messages