Search code examples
c#iisasp.net-mvc-5odata

Unable to connect to the remote server OData call


I'm having a problem calling an external OData service. When I call it from a small console test application I get no error. but when I call it from my web application I get the error: " Unable to connect to the remote server". When I used fiddler to see what the problem was it worked. I closed fiddler and it failed again (fiddler is using the system's defined proxy).

I'm using vs2015 and use my local IIS(v6.1) to host the website during development.

I've tried to add to proxy server in the web.config using system.net, but that didn't work either.

Is this a problem with IIS or is there something else I can do?


Solution

  • You can solve this issue using any of two ways mentioned below.

    1. You set web proxy programmatically while calling your OData service.
    2. You set web proxy in configuration file like below.

      <system.net>
        <defaultProxy useDefaultCredentials="true" />
      </system.net>