.NET Forum / ASP.NET / Web Services / May 2008
Accessing a web service - proxy problem
|
|
Thread rating:  |
Jon - 07 May 2008 17:11 GMT I wrote a VS 2005 C# express programme that accesses a web service. It works fine when there's a direct connection to the internet, but on two different PCs with internet access via a proxy, I get this exception:
System.Net.WebException: The request failed with HTTP status 407: Proxy Authentication Required. at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
The internet works fine on this PC with IE and Firefox. In these two browsers, a proxy is set up. Use a proxy server for your LAN is ticked, and the address and port (80) has been entered.
Am I right in saying that my programme is not able to access the settings of the web browsers, so I need to configure my programme with the proxy details. If so, how do I supply this information to the proxy. Or is there a way to access the settings from IE/Firefox?
Steven Cheng [MSFT] - 08 May 2008 07:34 GMT Hi Jon,
As for the network wroxy setting, for .NET webservice proxy class(or other webrequest components), you can explicitly assign a webproxy(and credentials if authentication required) to it. e.g.
===== Webservice client = new Webservice(); client.Proxy = new WebProxy(servername, port); =======
the following article provide a detailed example:
#Consuming a Webservice from behind a Proxy Firewall http://www.c-sharpcorner.com/UploadFile/thiagu304/webservicebehindproxy11212 006054829AM/webservicebehindproxy.aspx
Also, you can take full advantage of system or webbrowser proxy settings from .NET framework 2.0. However, the detailed behavior depand on the account under which your application is running and also the proxy setting model(global or per user) is used on the machine. Here is a good MSDN article mentioned details about proxy detection in .NET framework (from 11. to 2.0)
Hope this helps.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and suggestions about how we can improve the support we provide to you. Please feel free to let my manager know what you think of the level of service provided. You can send feedback directly to my manager at: msdnmg@microsoft.com.
================================================== Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. Please note that each follow up response may take approximately 2 business days as the support professional working with you may need further investigation to reach the most efficient resolution. The offering is not appropriate for situations that require urgent, real-time or phone-based interactions or complex project analysis and dump analysis issues. Issues of this nature are best handled working with a dedicated Microsoft Support Engineer by contacting Microsoft Customer Support Services (CSS) at http://msdn.microsoft.com/subscriptions/support/default.aspx. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights.
-------------------- From: "Jon" <.> Subject: Accessing a web service - proxy problem Date: Wed, 7 May 2008 17:11:35 +0100 I wrote a VS 2005 C# express programme that accesses a web service. It works fine when there's a direct connection to the internet, but on two different PCs with internet access via a proxy, I get this exception:
System.Net.WebException: The request failed with HTTP status 407: Proxy Authentication Required. at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClient Message message, WebResponse response, Stream responseStream, Boolean asyncCall) at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
The internet works fine on this PC with IE and Firefox. In these two browsers, a proxy is set up. Use a proxy server for your LAN is ticked, and the address and port (80) has been entered.
Am I right in saying that my programme is not able to access the settings of the web browsers, so I need to configure my programme with the proxy details. If so, how do I supply this information to the proxy. Or is there a way to access the settings from IE/Firefox?
Jon - 09 May 2008 09:43 GMT Hi Steven,
Thanks very much for your help with this.
You mentioned this article "Here is a good MSDN article mentioned details about proxy detection in .NET framework (from 11. to 2.0)" but didn't provide a link to it. Could you provide the link please?
Thanks,
Jon
Hi Jon,
As for the network wroxy setting, for .NET webservice proxy class(or other webrequest components), you can explicitly assign a webproxy(and credentials if authentication required) to it. e.g.
===== Webservice client = new Webservice(); client.Proxy = new WebProxy(servername, port); =======
the following article provide a detailed example:
#Consuming a Webservice from behind a Proxy Firewall http://www.c-sharpcorner.com/UploadFile/thiagu304/webservicebehindproxy11212 006054829AM/webservicebehindproxy.aspx
Also, you can take full advantage of system or webbrowser proxy settings from .NET framework 2.0. However, the detailed behavior depand on the account under which your application is running and also the proxy setting model(global or per user) is used on the machine. Here is a good MSDN article mentioned details about proxy detection in .NET framework (from 11. to 2.0)
Hope this helps.
Sincerely,
Steven Cheng
From: "Jon" <.> Subject: Accessing a web service - proxy problem Date: Wed, 7 May 2008 17:11:35 +0100 I wrote a VS 2005 C# express programme that accesses a web service. It works fine when there's a direct connection to the internet, but on two different PCs with internet access via a proxy, I get this exception:
System.Net.WebException: The request failed with HTTP status 407: Proxy Authentication Required. at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClient Message message, WebResponse response, Stream responseStream, Boolean asyncCall) at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
The internet works fine on this PC with IE and Firefox. In these two browsers, a proxy is set up. Use a proxy server for your LAN is ticked, and the address and port (80) has been entered.
Am I right in saying that my programme is not able to access the settings of the web browsers, so I need to configure my programme with the proxy details. If so, how do I supply this information to the proxy. Or is there a way to access the settings from IE/Firefox?
Steven Cheng [MSFT] - 09 May 2008 11:08 GMT Hi Jon,
Thanks for your reply.
Oops... I'm sorry for the omit. Trust me that I'm was not making joke :-).
here is the msdn reference, should be the best one which describe about the proxy settings I've seen so far:
#Take the Burden Off Users with Automatic Configuration in .NET http://msdn.microsoft.com/en-us/magazine/cc300743.aspx
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and suggestions about how we can improve the support we provide to you. Please feel free to let my manager know what you think of the level of service provided. You can send feedback directly to my manager at: msdnmg@microsoft.com.
================================================== Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif ications.
================================================== This posting is provided "AS IS" with no warranties, and confers no rights.
-------------------- From: "Jon" <.> References: <uiVHI0FsIHA.4912@TK2MSFTNGP03.phx.gbl> <vshFVWNsIHA.1784@TK2MSFTNGHUB02.phx.gbl> Subject: Re: Accessing a web service - proxy problem Date: Fri, 9 May 2008 09:43:08 +0100 Lines: 79 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3138 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 Message-ID: <enzi2CbsIHA.4848@TK2MSFTNGP05.phx.gbl> Newsgroups: microsoft.public.dotnet.framework.webservices NNTP-Posting-Host: 212.2.3.58 Path: TK2MSFTNGHUB02.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSFTNGP05.phx.gbl Xref: TK2MSFTNGHUB02.phx.gbl microsoft.public.dotnet.framework.webservices:3525 X-Tomcat-NG: microsoft.public.dotnet.framework.webservices
Hi Steven,
Thanks very much for your help with this.
You mentioned this article "Here is a good MSDN article mentioned details about proxy detection in .NET framework (from 11. to 2.0)" but didn't provide a link to it. Could you provide the link please?
Thanks,
Jon
Hi Jon,
As for the network wroxy setting, for .NET webservice proxy class(or other webrequest components), you can explicitly assign a webproxy(and credentials if authentication required) to it. e.g.
===== Webservice client = new Webservice(); client.Proxy = new WebProxy(servername, port); =======
the following article provide a detailed example:
#Consuming a Webservice from behind a Proxy Firewall http://www.c-sharpcorner.com/UploadFile/thiagu304/webservicebehindproxy11212 006054829AM/webservicebehindproxy.aspx
Also, you can take full advantage of system or webbrowser proxy settings from .NET framework 2.0. However, the detailed behavior depand on the account under which your application is running and also the proxy setting model(global or per user) is used on the machine. Here is a good MSDN article mentioned details about proxy detection in .NET framework (from 11. to 2.0)
Hope this helps.
Sincerely,
Steven Cheng
From: "Jon" <.> Subject: Accessing a web service - proxy problem Date: Wed, 7 May 2008 17:11:35 +0100 I wrote a VS 2005 C# express programme that accesses a web service. It works fine when there's a direct connection to the internet, but on two different PCs with internet access via a proxy, I get this exception:
System.Net.WebException: The request failed with HTTP status 407: Proxy Authentication Required. at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClient Message message, WebResponse response, Stream responseStream, Boolean asyncCall) at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
The internet works fine on this PC with IE and Firefox. In these two browsers, a proxy is set up. Use a proxy server for your LAN is ticked, and the address and port (80) has been entered.
Am I right in saying that my programme is not able to access the settings of the web browsers, so I need to configure my programme with the proxy details. If so, how do I supply this information to the proxy. Or is there a way to access the settings from IE/Firefox?
Steven Cheng [MSFT] - 13 May 2008 11:27 GMT Hi Jon,
Have you resolved the issue? Or does the article I posted in last message help you some?
If you have any further questions, welcome to post here.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and suggestions about how we can improve the support we provide to you. Please feel free to let my manager know what you think of the level of service provided. You can send feedback directly to my manager at: msdnmg@microsoft.com.
================================================== Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif ications.
-------------------- From: stcheng@online.microsoft.com (Steven Cheng [MSFT]) Organization: Microsoft Date: Fri, 09 May 2008 10:08:31 GMT Subject: Re: Accessing a web service - proxy problem
Hi Jon,
Thanks for your reply.
Oops... I'm sorry for the omit. Trust me that I'm was not making joke :-).
here is the msdn reference, should be the best one which describe about the proxy settings I've seen so far:
#Take the Burden Off Users with Automatic Configuration in .NET http://msdn.microsoft.com/en-us/magazine/cc300743.aspx
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Am I right in saying that my programme is not able to access the settings of the web browsers, so I need to configure my programme with the proxy details. If so, how do I supply this information to the proxy. Or is there a way to access the settings from IE/Firefox?
Free MagazinesGet these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...
|
|
|