System.Net.Sockets.SocketException (0x80004005) while downloading a file from windows service

0

while downloading a file got System.Net.Sockets.SocketException (0x80004005). I have a c# service application. while trying to download file one of my client got following exception

Code

        try
        {
            using (var client = new WebClient())
            {
                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
                client.DownloadFile(url, name);
                return true;
            }
        }
        catch (Exception e)
        {
            Logger.Error("Error inside DownloadFile");
            Logger.Error(e.message);
            Logger.Error(e.InnerException);
        }

Exception

Error inside DownloadFile Œfi∑®¡¨Ω”µΩ‘∂≥Ã∑˛ŒÒ∆˜ System.Net.Sockets.SocketException (0x80004005): ”…”⁄ƒø±Íº∆À„ª˙ª˝º´æ‹æ¯£¨Œfi∑®¡¨Ω”°£ 108.160.165.189: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)

from browser user can download file. but from service application issue occures. service is running as system user

c#
windows-services
webclient
socketexception
webclient-download
asked on Stack Overflow Jan 18, 2021 by Ijas • edited Feb 18, 2021 by Ijas

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0