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?
I spent almost 50 hours finding the problem, could not find anywhere on the web this simple solution.
Under "configuration" section in Web.config add this:
Then works like a charm!
You can also do it from the code behind:
Works beautiful!!.
If you need to consume from HTTPS location add this configuration:
Adding the Reference:
Make sure that you are adding the Reference like this. You need to click on "
Add Service Reference
", go to "Advanced
" and finally click on "Add Web Reference
".Then add the following:
For
port 8080
you use:Setup the Proxy for your Web Service:
To make sure that the Web Service is using your
Internet Explorer proxy
you can add the following to yourWeb Service
object on your client application.You can also set up the Proxy manually:
NTLM
If you use NTLM you will probably need to make sure that you use the Default Credentials on your client project as well. You can easily do this by passing it in when creating the Web Serivce using
UseDefaultCredentials
set totrue
.You can also disable NTLM Authentication for your Web Service project. You can do this under
Project Properties -> Web
. If you uncheck this option you should be able to add the Web Service without having to authenticate.http://msdn.microsoft.com/en-us/library/aa378749.aspx
I cannot automatically create web service reference using vs2010. I decide to use wsdl.exe tool, and in parameter named /parameters pass xml file with proxy server credentials
WSDL.exe generate a file Service1.cs (default). I add this file to my project and use it like this :
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
Right click on the console app and select add service reference.
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.
Give it a name and click on add ref.
Update: try updating web config/ app config and add;