.netsql-serverweb-servicesssissocketexception

System.Net.Sockets.SocketException (0x80004005) when the application account is logged off


I have an SQL Server Agent job that executes an SSIS package stored in the SSISDB. One of the tasks is the execution of the console application. The console application connects with web services hosted outside of the organization. The job's task is configured with a proxy account that is a domain account.

The job works fine, either executed manually or by the schedule when the proxy (domain) account is logged in to the server where the job and package are hosted.

But when the proxy account is logged off, the console application throws the following error:

Inner exception :: System.Net.Sockets.SocketException (0x80004005): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 109.205.54.105:443 at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)

The proxy account is in the local Administrator group. I tried adding the account to Distributed COM User, but that didn't help. The vendor that owns the web services says there's nothing bad in the logs.

What's causing this error? How to fix it? I'd appreciate your help.

UPDATE

I've checked with the security team and it appears that when the application is logged in then the traffic goes via a proxy. When the app account is logged off, it hits the firewall directly and the connection is dropped.

Things I've tried so far that didn't help:

Things that cause errors:

<system.net>  
    <defaultProxy>  
      <proxy usesystemdefault="true" />
    </defaultProxy>  
</system.net>

.NET Runtime

Application: iPersonel.SendData.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.Configuration.ConfigurationErrorsException at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean) at System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(System.Configuration.ConfigurationSchemaErrors) at System.Configuration.BaseConfigurationRecord.ThrowIfInitErrors() at System.Configuration.ClientConfigurationSystem.EnsureInit(System.String)

Exception Info: System.Configuration.ConfigurationErrorsException at System.Configuration.ClientConfigurationSystem.EnsureInit(System.String) at System.Configuration.ClientConfigurationSystem.PrepareClientConfigSystem(System.String) at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(System.String) at System.Configuration.ConfigurationManager.get_AppSettings() at SendData.Log.Logger..cctor()

Exception Info: System.TypeInitializationException at SendData.Log.Logger.GetOrRegister() at SendData.Program.Main(System.String[])

Application Error

Faulting application name: iPersonel.SendData.exe, version: 1.0.0.0, time stamp: 0xad1edd6c Faulting module name: KERNELBASE.dll, version: 10.0.17763.2028, time stamp: 0xc13cbc1f Exception code: 0xe0434352 Fault offset: 0x00123522 Faulting process id: 0x25f4 Faulting application start time: 0x01d788539cbe6d32 Faulting application path: D:\PLPayrollInterface\ConsoleApp\iPersonel.SendData.exe Faulting module path: C:\Windows\System32\KERNELBASE.dll Report Id: a2658be2-a18b-417f-ba29-6c525332b0cd Faulting package full name: Faulting package-relative application ID:

Would the .NET Runtime error indicate that there's something not OK in the app.config file? The project compiles with no errors.


Solution

  • Adding 2 attributes: useDefaultWebProxy and proxyAddress under the <basicHttpBinding> in the config file fixed the problem.

    <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="AuthenticationUrl" useDefaultWebProxy="false" proxyAddress="URI">
          <security mode="Transport" />
        </binding>
      </basicHttpBinding>
    </bindings></system.serviceModel>