使用代理的服务器,无法使用WebClient。报错:无法解析此远程名称: 'www.***.com'的解决方法

这段时间用WebClient做了一个小的爬取工具。在VS上调试一切正常。发布的IIS上就爬取不到了,直接报错:无法解析此远程名称: ‘www.***.com’。百度了一下大都是更改hosts,添加要爬取的网址;我也试了一下,并没有解决。偶然看到了一句 有可能是代理的问题。这段时间这客户这驻场还真是使用的代理上网。就试了一下,完美解决。
给WebClient使用代理的代码如下:

WebClient myWebClient = new WebClient();
string txtHost = 代理地址
int txtPort =代理端口
string txtUserName =代理账户 用户名
string txtPwd =代理账户 密码
NetworkCredential cre = new NetworkCredential(txtUserName, txtPwd);
WebProxy proxy = new WebProxy(txtHost, txtPort) { Credentials = cre };
myWebClient.Proxy = proxy;

使用代理的服务器,无法使用WebClient。报错:无法解析此远程名称: 'www.***.com'的解决方法相关推荐

  1. 搭建网站服务器时报错url,服务器网站总报错“ERROR the requested URL could not be retrieved”解决办法...

    服务器网站总报错"ERROR the requested URL could not be retrieved" ERROR The requested URL could not ...

  2. svn update 报错,必须先cleanup,然后cleanup失败解决方法

    svn update 报错,必须先cleanup,然后cleanup失败解决方法 参考文章: (1)svn update 报错,必须先cleanup,然后cleanup失败解决方法 (2)https: ...

  3. 安装linux 系统报错:No DEFAULT or UI configuration directive found 解决方法

    安装linux 系统报错:No DEFAULT or UI configuration directive found 解决方法 参考文章: (1)安装linux 系统报错:No DEFAULT or ...

  4. 使用ANT编译项目报错 com.sun.image.codec.jpeg does not exist 解决方法

    使用ANT编译项目报错 com.sun.image.codec.jpeg does not exist 解决方法 参考文章: (1)使用ANT编译项目报错 com.sun.image.codec.jp ...

  5. 【pycharm】pycharm上安装tensorflow,报错:AttributeError: module ‘pip‘ has no attribute ‘main‘ 解决方法

    [pycharm]pycharm上安装tensorflow,报错:AttributeError: module 'pip' has no attribute 'main' 解决方法 参考文章: (1) ...

  6. mycat重启报错Failed to connect to the Wrapper at port解决方法

    mycat重启报错Failed to connect to the Wrapper at port解决方法 参考文章: (1)mycat重启报错Failed to connect to the Wra ...

  7. maven文件报错(pom.xml或者jar包缺失)解决方法

    maven文件报错(pom.xml或者jar包缺失)解决方法 参考文章: (1)maven文件报错(pom.xml或者jar包缺失)解决方法 (2)https://www.cnblogs.com/wa ...

  8. 报错:Parameter ‘XXX‘ implicitly has an ‘any‘ type.解决方法

    报错:Parameter 'XXX' implicitly has an 'any' type.解决方法 tsconfig.json添加"noImplicitAny": false ...

  9. http请求报错Illegal character in query at index 303的解决方法

    http请求报错"Illegal character in query at index 303"的解决方法 执行jmeter的http请求时,请求失败,在Sampler resu ...

最新文章

  1. Rest Framework:序列化组件
  2. 装饰器模式与java.io包
  3. qt creator 构建(build) 执行cmake 部署的区别?(未解决)
  4. JS正则表达式校验金额
  5. Disruptor并发框架-2
  6. c6011取消对null指针的引用_C++中的引用
  7. 2011辞职日志:辞职最关键时刻在下周一
  8. Linux命令之感叹号 !
  9. loadDataWithBaseURL加载HTML数据
  10. 八年测开经验面试28K公司后,吐血整理出高频面试题和答案
  11. 这顶海贼王的帽子,我Python给你带上了 | 【人脸识别应用】
  12. GBDT 如何用于分类问题
  13. Flex中实现Tree绑定数据后自动展开节点
  14. linux系统奔溃之vmcore:kdump 的亲密战友 crash
  15. 使用CSS给文字添加描边效果
  16. 程序员学习资料分享---爱分享的程序员(新浪微博)
  17. 计算机应用 一级学科,一级学科、二级学科,考研专业哪个包含了计算机考研方向...
  18. 进度条Progress的用法介绍
  19. 如何看计算机cpu的好坏,cpu主要的性能参数有哪些、怎么看?教你几招轻松看懂CPU性能好坏...
  20. 【LeetCode-SQL】603. 连续空余座位

热门文章

  1. 2022前端面试总结
  2. 文献阅读——Exploiting Cloze Questions for Few Shot Text Classification and Natural Language Inference
  3. Leetcode典型题解答和分析、归纳和汇总——T160(相交链表)
  4. ubuntu16.04安装g2o
  5. Centos服务器的端口映射
  6. java项目中使用hutool工具箱
  7. ArcGIS And ENVI:如何进行植被指数的提取并制作成专题地图?
  8. 如何在程序运行时获取 dpdk-16.04 大页使用情况?
  9. PCIe实用调试工具MindShare Arbor一直用
  10. 在vue项目中webpack打包后字体不生效