Request property is always null

34 views
Skip to first unread message

jo...@thesimonshouse.com

unread,
May 24, 2016, 3:30:55 AM5/24/16
to RavenDB - 2nd generation document database
This code has a bug:

You need to use the conditional directive (#if !DNXCORE50) to also populate the Request property.

Easy to repro:
documentStore.JsonRequestFactory.ConfigureRequest += (sender, args) =>
            {
                args.Request.Proxy = new WebProxy(new Uri("http://localhost:8889"), false);
            };


This is in v3.0

Cheers
John

Oren Eini (Ayende Rahien)

unread,
May 24, 2016, 8:11:46 AM5/24/16
to ravendb
That isn't a bug, you are expected to use the Client in 3.0

Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

 


--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

John Simons

unread,
May 24, 2016, 8:56:13 AM5/24/16
to ravendb
So how do u set the proxy via the client?
You received this message because you are subscribed to a topic in the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ravendb/DtQk1h6tdEo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ravendb+u...@googlegroups.com.

Oren Eini (Ayende Rahien)

unread,
May 24, 2016, 8:59:14 AM5/24/16
to ravendb
var httpClientHandler = new HttpClientHandler
                        {
                            Proxy = new WebProxy("http://localhost:8888", false),
                            UseProxy = true
                        }

John Simons

unread,
May 24, 2016, 9:57:06 AM5/24/16
to ravendb
I may be looking at this wrong but I can't see a way to replace the handler on the HttpClient instance, and I don't think u saying to replace the whole Client? Actually I don't think that would work anyway.

jo...@thesimonshouse.com

unread,
May 24, 2016, 7:57:52 PM5/24/16
to RavenDB - 2nd generation document database
So I have tried:
documentStore.JsonRequestFactory.ConfigureRequest += (sender, args) =>
            {
                args.Client = new HttpClient(new HttpClientHandler
                {
                    UseDefaultCredentials = true,
                    Credentials = CredentialCache.DefaultNetworkCredentials,
                    Proxy = new WebProxy(new Uri("http://localhost:8888/"), false),
                    UseProxy = true,
                });
            };

But it doesn't work, because args.Client is ignored.
Any other ideas ?

Maxim Buryak

unread,
May 25, 2016, 12:32:07 PM5/25/16
to rav...@googlegroups.com
Hi, 
Please try attached example, note that local addresses/proxies won't be supported

 using (var store = new DocumentStore
                {
                    Url = RAVEN_URL,               
                    DefaultDatabase = store.DefaultDatabase,
                    HttpMessageHandlerFactory = () =>
                    new HttpClientHandler
                    {
                        UseDefaultCredentials = true,
                        Credentials = CredentialCache.DefaultNetworkCredentials,
                        Proxy = new WebProxy(new Uri(PROXY_ADDRESS), false),
                        UseProxy = true,
                    }

                })



Best Regards,

Hibernating Rhinos Ltd  cid:image001.png@01CF95E2.8ED1B7D0

Maxim Buryak l Core Team Developer Mobile:+972-54-217-7751

RavenDB paving the way to "Data Made Simplehttp://ravendb.net/  


Maxim Buryak

unread,
May 25, 2016, 12:40:33 PM5/25/16
to rav...@googlegroups.com
* local addresses won't be supported, local proxis are just fine



Best Regards,

Hibernating Rhinos Ltd  cid:image001.png@01CF95E2.8ED1B7D0

Maxim Buryak l Core Team Developer Mobile:+972-54-217-7751

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

RavenDB paving the way to "Data Made Simplehttp://ravendb.net/  



Reply all
Reply to author
Forward
0 new messages