locked
Calling LS Odata services via HTTP proxy RRS feed

  • Question

  • Hi,

    I have an excel addin containing a service reference to an LS OData service (https://mydomain/myapp/applicationdata.svc) that is hosted on a public facing web server that works fine until the addin is deployed on a network using an HTTP proxy server.

    My question is whether there is a way to declaratively or programmatically configure the generated service client in VS2012 to route requests to my LS OData service via an HTTP proxy.

    I am easily able to do this in a WCF service by changing the ProxyAddress property of an HTTPBinding or by programmatically altering the service bindings on the client. Is there a way to similarly configure an LS OData service client?

    Many thanks.

    Friday, October 12, 2012 5:36 AM

Answers

  • Hi

    I have an idea, if you want to visit via proxy, you could use HttpWebRequest, then set Proxy.<//span>

    Uri newUri=new Uri(proxyAddress);
            
    // Associate the newUri object to 'myProxy' object so that new myProxy settings can be set.
            myProxy.Address=newUri;
            
    // Create a NetworkCredential object and associate it with the  
            
    // Proxy property of request object.
            myProxy.Credentials=
    new NetworkCredential(username,password);
            myWebRequest.Proxy=myProxy;

    hope it helps you.

    Regards

    <//span>
    • Marked as answer by VerserTech Sunday, October 21, 2012 6:24 AM
    Thursday, October 18, 2012 7:59 AM

All replies

  • Hi

    I have an idea, if you want to visit via proxy, you could use HttpWebRequest, then set Proxy.<//span>

    Uri newUri=new Uri(proxyAddress);
            
    // Associate the newUri object to 'myProxy' object so that new myProxy settings can be set.
            myProxy.Address=newUri;
            
    // Create a NetworkCredential object and associate it with the  
            
    // Proxy property of request object.
            myProxy.Credentials=
    new NetworkCredential(username,password);
            myWebRequest.Proxy=myProxy;

    hope it helps you.

    Regards

    <//span>
    • Marked as answer by VerserTech Sunday, October 21, 2012 6:24 AM
    Thursday, October 18, 2012 7:59 AM
  • Excuse my ignorance but I am new to developing in C # lightswitch and therefore can not understand where should I deploy this code.
    I figured that would be the web.conf but it did not work.

    My situation is as follows:
    Develop an application to control students to the institution where I work and I need the database to be on an external server, the problem is that the internal network uses a proxy which we have no access to the server because it is a network of state, if it had access to the proxy server was set up only for the server to connect directly to the address of the bank without going through the proxy, in which case there is no such possibility, I created a DNS entry for my external server, so it is not necessary to inform IP and port served neither which prevents it from being blocked by the proxy server in the foreign network where the proxy does not operate normally.
    The problem is I can not configure the application to obtain the e-proxy example http://servidor_de_proxy:8080

    If you can help me, I thank you.
    Tuesday, November 6, 2012 10:25 AM