问题描述
下载文件时,我得到:
System.Net.sockets.socketException (0x80004005)。
我有一个 C# 服务应用程序。在尝试下载文件时,我的一位客户出现以下异常。
代码
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);
}
例外
下载文件中的错误 Œfi∑®¡¨Ω”µΩ'∂≥Ã∑˛ŒÒ∆~ System.Net.sockets.socketException (0x80004005): “…”⁄ƒø±Íº∆À„ª˙ª˝º´æ‹æ¯£¨Œfi∑®¡Ω”°£ 108.160.165.189:443 在 System.Net.sockets.socket.DoConnect(EndPoint endPointSnapshot,SocketAddress socketAddress) 在 System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure,Socket s4,Socket s6,Socket& socket,IPAddress& address,ConnectSocketState state,IAsyncResult asyncResult,Exception&异常)
用户可以从浏览器下载文件。但是从服务应用程序中会出现问题。该服务以系统用户身份运行。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)