Intermittently facing 407 proxy authentication error while communication with multiple api's

45 Views Asked by At

I use postman to automate some of my api testing, I face 407 proxy error while trying to communicate with certain api intermittently, it fails like 10/100 requests made.

While we tried checking with our network team and check with wireshark application, it was evident the user creds are not getting passed during the times when the failure occured. What can we do fix this issue. We do not want to go with setting a certain proxy at the application level since it may affect all the APIs getting called from there

1

There are 1 best solutions below

0
Christian On

I most probably figured it out. So far the fix below worked 100%

To be specific about to context, when testing a web-service (on the client-stub side of course), I kept getting, at random time, the following exception:

The remote server returned an unexpected response: (407) Proxy Authentication Required

I was getting it when working from within a VPN zone, but not always (I got it about 20% of the time).

If you can connect with your web-services with a standard Internet browser, while your application can't, then it means you can do something to fix your application! For instance, try to browser to your web-services' ASMX "home page" in which all exposed web-methods are listed. If this works, then adding the below to the client-application's config file made the whole difference

<!-- to prevent "The remote server returned an unexpected response: -->
<!--             (407) Proxy Authentication Required"               -->

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