Http Client Protocol Issues

If you use any of these solutions, Please let me know so I can track if any of this is useful to you! Thanks! This is an area to share observations I have made working with Http Client Protocols and the associated technologies. I currently work for the Microsoft team that supports the WinInet, WinHTTP and System.Net API's and classes associated with these technologies. This is not a replacement for Microsoft Support, but an area to discuss these technologies. These postings are provided "AS IS" with no warranties, and confer no rights. Use of included code samples are subject to the terms specified at Microsoft - Information on Terms of Use

HttpWebRequest exception: "Unable to connect to the remote server" when using .INS config files

Problem 

Taking a System.Net Trace (see My Favorite System.Net Tracing File) you will see that the HttpWebRequest is trying to use a .INS file.

System.Net Verbose: 0 : [0371] WebRequest::Create(http://myserver/ie/update/windows/IEConfig.INS)

It is successfully retrieved but when the request is made you see something similar to this in the .NET log:

System.Net.Sockets Error: 0 : [0371] Exception in the Socket#4094998::Connect - No connection could be made because the target machine actively refused it 192.168.0.202:443

and

System.Net Error: 0 : [0371] Exception in the HttpWebRequest#33574999:: - Unable to connect to the remote server

Resolution

System.Net by design does not process .INS files.  This results in the HTTP Request being made direct and the Proxy is denying this action.

You need choose one of these methods to resolve the issue:

1. Change your environment to use .PAC files.  For example, set this in IE or use the AutoConfigUrl key.

2. Change your .NET code to hard code the proxy information

3. Add proxy configuration information to your <<application>>.exe.config, web.config or machine.config files.


-Jeff

Published Tuesday, March 24, 2009 10:27 AM by jpsanders

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

 

Greg said:

Is it the same with Winhttp as with System.Net?

October 15, 2009 9:18 AM
 

jpsanders said:

Yes, WinHttp does not support .ins files.  Use netsh or winhttpcfg to configure proxy settings for WinHttp.

October 15, 2009 9:23 AM
 

jrv said:

What happens deep down is a bit more exciting, although the result is the same. If you create a test .NET program, uncheck "Enable Just My Code" (tools, options, debugging), and catch all exceptions when thrown, you will catch yourself a parse exception inside a javascript engine. .NET apparently downloads the "ins" file, but assumes it is a pac file and feeds it to the javascript engine for evaluation. As an ins file it naturally fails the javascript parsing. ["Take the Burden Off Users with Automatic Configuration in .NET" Durgaprasad Gorti, http://msdn.microsoft.com/en-us/magazine/cc300743.aspx]

Thanks, BTW. This is the first even semi-official confirmation of the behavior our client observed.

JR

December 5, 2009 1:04 PM

Leave a Comment

(required) 
(optional)
(required) 

  
Enter Code Here: Required
Submit

© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Microsoft
Page view tracker