Proxy server and webservice

J

Jan Rasmussen

I have installed a windowsservice at a customer, and this service should
communicate with a webservice here by me. This works fine a lot of places,
but now it has been installed by a customer who runs a proxy server, and all
http-communication from the workstations runs on port 88 instead of the
default port 80.
Now the windowsservice starts with an error message: Can't connect to host

How do I work around that problem ?

TIA

Jan
 
D

Dino Chiesa [Microsoft]

You can set a global proxy in a config file [1], or in code [2], or you can
set a proxy server per webservice,
via the Proxy property on the clien-side stub (generated from WSDL). [3]

These examples show how to set the proxy without authentication:

eg [1], in machine.config, add
<configuration>
<system.net>
...
<defaultProxy>
<proxy
usesystemdefault = "false"
proxyaddress=http://proxyserver:8089
bypassonlocal="true" />
</defaultProxy>
...
</system.net>
</configuration>

eg [2]
using System.Net; // contains GlobalProxySelection class
...
Uri proxyURI = new Uri("http://proxyserver::8089");
GlobalProxySelection.Select = new WebProxy(proxyURI);


eg [3]
p = MyWebService(); // stub generated from wsdl.exe, inherits from
System.Web.Services.Protocols.SoapHttpClientProtocol
p.Proxy = new System.Net.WebProxy("http://proxyserver:8089",false); //
true == don't use proxy for local addresses

In any of those cases you can also set up a proxy that requires
authentication (username and password).

references:
[1]
http://msdn.microsoft.com/library/en-us/cpgenref/html/gngrfDefaultProxyElement.asp
[2]
http://msdn.microsoft.com/library/en-us/cpguide/html/cpconaccessinginternetthroughproxy.asp
[3]
http://msdn.microsoft.com/library/e...otocolsSoapHttpClientProtocolMembersTopic.asp


-D
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top