"Error creating the web proxy" exception calling Web Service from a .NET Executable on a Network Share

Proposed Answer "Error creating the web proxy" exception calling Web Service from a .NET Executable on a Network Share

  • Wednesday, January 25, 2012 7:49 PM
     
     

    Hi,

    I have seen a lot of posts regarding an issue where a "Error creating Web Proxy" exception is thown from within a Windows Forms application that is hosted on a network share tries to connect to a Web Service.  This appears to only occur under Windows Server 2008 R2 (x64), and it runs fine from within Windows Server 2003 (x86)

     

    The workarounds that I have seen are to copy the executable to a local drive.  That workaround doesn't work well with us as we want to store our VS code on a network share for backup purposes.  

    We have run the CASPOL to grant "Full Trust" to all Trusted Sites, and these network shares are from within our domain. 

    Does anyone out there have a solution that doesn't involve running the .exe from a local drive?

    EXCEPTION DETAILS 

    System.Configuration.ConfigurationErrorsException occurred
      Message=Error creating the Web Proxy specified in the 'system.net/defaultProxy' configuration section.
      Source=System
      BareMessage=Error creating the Web Proxy specified in the 'system.net/defaultProxy' configuration section.
      Line=0
      StackTrace:
           at System.Net.Configuration.DefaultProxySectionInternal.GetSection()
           at System.Net.WebRequest.get_InternalDefaultWebProxy()
           at System.Net.HttpWebRequest..ctor(Uri uri, ServicePoint servicePoint)
           at System.Net.HttpRequestCreator.Create(Uri Uri)
           at System.Net.WebRequest.Create(Uri requestUri, Boolean useUriBase)
           at System.Web.Services.Protocols.WebClientProtocol.GetWebRequest(Uri uri)
           at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebRequest(Uri uri)
           at System.Web.Services.Protocols.SoapHttpClientProtocol.GetWebRequest(Uri uri)
           at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
           at Canwest.Broadcasting.Windows.Classes.CW_Common_2008.INCWebService.InfoCentral.GetReportParameters(Int64 plReportInstanceID)
           at Canwest.Broadcasting.Windows.Classes.CW_Common_2008.InfoCentral.GetReportParameters(Int64 plReportInstanceID)
      InnerException: System.Net.Sockets.SocketException
           Message=An invalid argument was supplied
           Source=System
           ErrorCode=10022
           NativeErrorCode=10022
           StackTrace:
                at System.Net.SafeCloseSocketAndEvent.CreateWSASocketWithEvent(AddressFamily addressFamily, SocketType socketType, ProtocolType protocolType, Boolean autoReset, Boolean signaled)
                at System.Net.NetworkAddressChangePolled..ctor()
                at System.Net.AutoWebProxyScriptEngine.AutoDetector.Initialize()
                at System.Net.AutoWebProxyScriptEngine..ctor(WebProxy proxy, Boolean useRegistry)
                at System.Net.WebProxy.UnsafeUpdateFromRegistry()
                at System.Net.Configuration.DefaultProxySectionInternal..ctor(DefaultProxySection section)
                at System.Net.Configuration.DefaultProxySectionInternal.GetSection()
           InnerException:



All Replies

  • Friday, April 13, 2012 7:24 PM
     
     Proposed Answer

    OK, so after about two months of cricket chirping silence, and 745 reads of this post, I will answer my own post as I found a workaround.

    The workaround is to set your "Output Path" in the Build tab of the project options to a local disk/folder, and not to the network drive where the code resides (which is the default).  In my case, I set it to C:\_Build\<projectname>.

    This resolves the issue.  I am quite surprised that nobody else has experienced this issue as it happens on all of our x64 Window Server 2008 R2 developer systems.

    I hope that this will be helpful to somebody else out there.


    Peter

    • Proposed As Answer by Iric Wen Friday, May 04, 2012 7:05 AM
    •  
  • Monday, May 14, 2012 3:25 PM
     
     

    Hi Peter,

    We are experiencing the same problem which is also mentionned in this thread :

    http://social.msdn.microsoft.com/Forums/en-US/wsk/thread/3076a9cd-57a0-418d-8de1-07adc3b486bb

    In our case, it works well from one network share but not from another one. It has to do with read permissions on the root of the share.

    I have yet to find a solution. If I do, I'll post the reply here. In my book, it is a Windows bug : what does the root folder permission have to do with the ability of an executable to open a socket ?...

    Thanks,