Error creating Web proxy

James picture James · Jul 21, 2009 · Viewed 11.1k times · Source

I have a CLR enabled .NET app that accesses a webservice and writes an xml file to a webserver for a SQLServer SSIS package to digest. Everything works fine on the development servers, but the production server returns the following error:

Error creating the Web Proxy specified in the 'system.net/defaultProxy' configuration section.: 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 MyDBProj.com.dmsintegration.secure.VehicleInventoryService.RetriveVehicleInventory(RetrieveAllRecordsRequest request) at UserDefinedFunctions.LoadDMSFile(String dealer_id, String dms_username, String dms_password, String dms_location_id)

There are no differences between the server OS versions or the SQLServer versions. We are using Windows Server 2003 R2 and SQL Server 2005. I believe it must be a configuration on the server itself but I cannot find any differences between the servers. Neither server runs a software firewall.

Full Exception:

System.Configuration.ConfigurationErrorsException: Error creating the Web Proxy specified in the 'system.net/defaultProxy' configuration section. ---> System.DllNotFoundException: Unable to load DLL 'rasapi32.dll': A dynamic link library (DLL) initialization routine failed. (Exception from HRESULT: 0x8007045A)
at System.Net.UnsafeNclNativeMethods.RasHelper.RasEnumConnections(RASCONN[] lprasconn, UInt32& lpcb, UInt32& lpcConnections) at System.Net.UnsafeNclNativeMethods.RasHelper.GetCurrentConnectoid() 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() --- End of inner exception stack trace --- 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 MyDBProj.com.dmsintegration.secure.VehicleInventoryService.RetriveVehicleInventory(RetrieveAllRecordsRequest request) at UserDefinedFunctions.LoadDMSFile(String dealer_id, String dms_username, String dms_password, String dms_location_id)

Answer

flip picture flip · Feb 14, 2012

We had exactly the same error message when calling a Web service from a .Net Winform application.

In our case the error occurred for one user, but not for the other (with local admin permissions) on the same server.

In fact it has nothing to with WCF; you would have the same error when calling a simple web page from your app. The executing user account is not allowed to open a Web Proxy connection.

We solved the problem by moving the application into C:\Program Files. For a reason I can't yet explain exactly, from this folder the same user can create the Proxy.

Any insight on this would be welcome.