Autofac Multicore with custom HttpWebRequestFactory

94 views
Skip to first unread message

Brandon O'Dell

unread,
Feb 20, 2015, 1:09:25 PM2/20/15
to sol...@googlegroups.com
Is there a proper way to be configuring multiple cores with a custom HttpWebRequestFactory?
Here is my sample code:

 var cores = new SolrServers {
       
new SolrServerElement {
               
Id = "coreEntity1",
               
DocumentType = typeof (Entity1).AssemblyQualifiedName,
               
Url = "http://localhost:8983/solr/coreEntity1",
                                       
           
},
               
new SolrServerElement {
               
Id = "coreEntity2",
               
DocumentType = typeof (Entity2).AssemblyQualifiedName,
               
Url = "http://localhost:8983/solr/coreEntity2",                                        
           
},
   
};
   
//register solr instance
    builder
.RegisterModule(
       
new SolrNetModule(cores)
       
{
           
HttpWebRequestFactory = new BasicAuthHttpWebRequestFactory(
               
"username",
               
"password",
                delegate { return true; }) //dont validate SSL (Self Signed Cert)
    });  


 
When I resolve either of my cores, I am getting an authentication error, and stepping through the code, I can also see that the BasicaAuthHttpWebRequestFactory was never attached to the ISolrOperations<>.   Looking at the source code, it appears that it might be supported only for single core configuration via Autofac. Can someone please verify this?

Thanks,
Brandon

   

Mauricio Scheffer

unread,
Mar 1, 2015, 7:10:09 PM3/1/15
to sol...@googlegroups.com
I recommend getting rid of the SolrNet+IoC integration libraries. As you've already seen, there is no way to reason about any of this stuff.
I also recommend getting rid of all IoC containers in your app entirely (same argument), but if that's too hard, just register the ISolrOperations<T> instances you compose.

Cheers



--
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 http://groups.google.com/group/solrnet.
For more options, visit https://groups.google.com/d/optout.

Brandon O'Dell

unread,
Mar 4, 2015, 7:05:13 PM3/4/15
to sol...@googlegroups.com
Thanks for the feedback Mauricio.  

I've seen various arguments regarding the use / not to use IoC.  I know its a bit off topic, but what is your opinion / reasoning against IoC?

Cheers,
Brandon
Reply all
Reply to author
Forward
0 new messages