开发者

Solrnet - How to initialize instance with basic authentication

开发者 https://www.devze.com 2023-02-07 21:14 出处:网络
It is possible to conne开发者_高级运维ct solr instance with basic authentication ? I have tried with :

It is possible to conne开发者_高级运维ct solr instance with basic authentication ?

I have tried with :

Startup.Init<Page>("http://user:mdp@localhost:8080/solr");

But it doesn't work.

have you got a solution ?

Thanks.


Try this

string solrUser = "user"; // replace with your credentials
string solrPwd = "mdp"; // replace with your credentials

var connection = new SolrConnection("http://localhost:8080/solr")
            {
                HttpWebRequestFactory = new HttpWebAdapters.BasicAuthHttpWebRequestFactory(solrUser, solrPwd)
            };

Startup.Init<Page>(connection);


Implement a IHttpWebRequestFactory that returns an authenticated web request. See http://code.google.com/p/solrnet/issues/detail?id=66

0

精彩评论

暂无评论...
验证码 换一张
取 消