Search code examples
c#asmxproxy-authentication

add web service reference from behind a proxy server


I'm using vs2010. In a simple console app I try to add a service reference to http://***/service1.asmx , old asmx service. My computer is behind a proxy server, so i get an error :

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

When im using wsdl tool i can not define proxy server port number and i get message that server, for examle 10.0.0.3:80, did not respond, but i need to specify 8080 port and don't know how. How could i create a reference?


Solution

  • Take a look at the links below for specifying the proxy address and server port when adding a web reference.

    http://msdn.microsoft.com/en-us/library/bb628649.aspx

    http://msdn.microsoft.com/en-us/library/03seed2h.aspx

    To add a reference to an asmx

    1. Right click on the console app and select add service reference.

    2. Click on the advanced button and enter the asmx address in the address bar. Click on the green button next to it to discover the asmx.

    3. Give it a name and click on add ref.

    Update: try updating web config/ app config and add;

    <system.net>
    
    <defaultProxy>
    <proxy usesystemdefault="True" proxyaddress="http://[your proxy address and port number]"  bypassonlocal="True"/>
    
    </defaultProxy>
    
    </system.net>