使用WebClient 或者 HttpWebRequest均报:"The Remote name can't be solved"
错误原因: 未配置代理服务器设置的问题, 需要在配置节做如下操作.
============================================
文章编号: 318140 - 查看本文应用于的产品
机器翻译查看机器翻译免责声明
逐句中英文参照视图Microsoft 支持页面的机器翻译
展开全部 | 关闭全部
Collapse image本文内容
Collapse image症状
注意:这篇文章中引用了以下.NET Framework 类库命名空间:
System.Net
当您使用.NET 客户端使用的 HTTP 代理服务器的 Web 服务时,您可能会收到以下错误消息:
基础连接已关闭: 无法解析此远程名称。
回到顶端回到顶端 | 提供反馈
Collapse image原因
HTTP 代理服务器的 Web 服务,.NET 客户端之间不存在和尚未配置正确的代理服务器设置。
回到顶端回到顶端 | 提供反馈
Collapse image解决方案
要解决此问题,请提供正确的代理向.NET 客户端配置设置。
回到顶端回到顶端 | 提供反馈
Collapse image更多信息
Machine.config 文件中的默认设置如下:
<configuration>
<system.net>
<defaultProxy>
<proxy
usesystemdefault = "true"
/>
</defaultProxy>
</system.net>
</configuration>
默认设置不会自动检测代理服务器设置,如果将usessystemdefault设置为 false,然后显式指定的代理服务器。若要显式指定代理服务器,使用的 Machine.config 或 Web.config 文件,或以编程方式指定的服务器。
若要指定代理服务器,设置的 Machine.config 或 Web.config 文件设置,如下所述:
<configuration>
<system.net>
<defaultProxy>
<proxy
usesystemdefault = "false"
proxyaddress="http://proxyserver"
bypassonlocal="true"
/>
</defaultProxy>
</system.net>
</configuration>
若要使用web 代理对象以编程方式更改设置,请使用下面的代码示例:
Using System.Net;
com.someserver.somewebservice.someclass MyWebServiceClass = new com.someserver.somewebservice.someclass();
IWebProxy proxyObject = new WebProxy("http://myproxyserver:80", true);
MyWebServiceClass.Proxy = proxyObject;
MyWebServiceClass.MyWebMethod();
要求 NTLM 身份验证的代理服务器
若要设置 NTML 身份验证的代理服务器,请使用下面的代码示例:
Using System.Net;
WebProxy myProxy = new WebProxy("http://proxyserver:port",true);
myProxy.Credentials = CredentialCache.DefaultCredentials;
FindServiceSoap myFindService = new FindServiceSoap();
myFindService.Proxy = myProxy;
您还可以使用系统范围的代理为默认值。
<configuration>
<system.net>
<defaultProxy>
<proxy
proxyaddress = "http://proxyserver:80"
bypassonlocal = "true" />
</defaultProxy>
</system.net>
</configuration>
回到顶端回到顶端 | 提供反馈
使用WebClient 或者 HttpWebRequest均报:"The Remote name can't be solved"的更多相关文章
- 导入maven项目各个注解均报错了
所遇问题: 导入maven项目各个注解均报错了; 思考1: 这个项目使用了springboot;spring是个”大容器”,所有对象的创建和管理都交给了它, (SpringBoot是一个框架,一种全新 ...
- 使用WebClient與HttpWebRequest的差異
在<Windows Phone 7-下載檔案至Isolated Storage>提到了透過WebClient的功能將網站上的檔案下載至 WP7的Isoated Storage之中.但實際的 ...
- C#的提交表单方式主要有两种WebClient与HttpWebRequest
根据黄聪:C#模拟网站页面POST数据提交表单(转) using System; using System.Collections.Generic; using System.IO; using Sy ...
- Spark1.3使用外部数据源时条件过滤只要是字符串类型的值均报错
CREATE TEMPORARY TABLE spark_tbls USING org.apache.spark.sql.jdbc OPTIONS ( url 'jdbc:mysql://hadoop ...
- Tomcat正常启动,访问所有页面均报404异常,404异常总结
今天遇到一个问题:Tomcat正常启动,访问所有页面均报404异常 404异常,很常见,大多情况是路径错误.web.xml文件映射路径写错.服务器设置.servlet的jar包未导进去或者没有随项目发 ...
- 使用tortoisegit工具git地址中带号码密码的拉取,以及使用这种方式后中途重置密码报git remote: HTTP Basic: Access denied 错误解决办法
1. 在拉取git项目时可以在地址中直接指定号码密码如下就可以直接拉取下来 https://username:password@github.com 需要注意,因为在解析地址时是以@符号作为地址信 ...
- SecureCRT连接Ubuntu报The remote system refused the connection.解决方案
使用SecureCRT连接到远程Ubuntu,连接失败报The remote system refused the connection. 进入Ubuntu系统,终端中敲入以下命令: ps -ef|g ...
- git报错 - remote: HTTP Basic: Access denied
十年河东,十年河西,莫欺少年穷 学无止境,精益求精 git 拉取代码报: remote: HTTP Basic: Access denied,这是因为你的GIT密码修改后,需要重新认证授权,那么怎么操 ...
- [解决WebClient或HttpWebRequest首次连接缓慢问题]
[编程环境]Visual Studio 2010, NET4.0 [开发语言]C#, 理论上VB.NET等依赖.NET Framework框架的语言均受此影响 [问题描述] 使用HttpWebRequ ...
随机推荐
- Node.js基础与实战
Node.js基础与实战 Node.jsJS高级进阶 NODE原理与解析 REPL交互环境 模块与NPM Buffer缓存区 fs文件操作 Stream流 TCP&UDP 异步编程 HTTP& ...
- Android学习笔记(九)
Android中的四种基本布局 1.LinearLayout LinearLayout称为线性布局,是一种常用的布局.修改activity_main.xml中的代码,如下所示: <LinearL ...
- 使用Visual Studio调试用户模式进程(Debugging a User-Mode Process Using Visual Studio)
由于本人能力有限,翻译不足之处敬请谅解,欢迎批评指正:sunylat@163.com Visual Studio版本:Visual Studio 2015企业版,中文环境. MSDN原文:https: ...
- 用Spring+Junit4.4进行测试(使用注解)
http://nottiansyf.iteye.com/blog/345819 使用Junit4.4测试 在类上的配置Annotation @RunWith(SpringJUnit4ClassRunn ...
- SVN版本问题:svn: E155021: This client is too old to work with the working copy at
最近Android Studio SVN老是提示: SVN版本问题:svn: E155021: This client is too old to work with the working copy ...
- git 源代码下载和安装(CentOS)
1.阅读INSTALL文件 $ make configure ;# as yourself$ ./configure --prefix=/usr ;# as yourself$ make all do ...
- 安卓APP测试验证点总结
最近较懒,加之闺女出生后记忆没完全恢复,总是忘东忘西,关于安卓APP测试的验证点还是总结一下,方便设计测试用例时查阅,也给各位博友参考! 1.除APP的正常功能点外,还有以下验证点: 安装/卸载(考虑 ...
- jQuery-表单流程导航
前言:以前做过一个项目,里面牵涉到流程相关的业务,需要用到流程页面导航的效果,完整的工作流相关的项目以前也做过,需要用到第三方插件,当然这里记录的业务需求没这个麻烦,仅仅需要能有一个页面导航的标题栏, ...
- 使用BigDecimal进行精确运算
首先我们先来看如下代码示例: 1 public class Test_1 { 2 public static void main(String[] args) { 3 System.out.print ...
- This kind of launch is configured to open the Debug perspective when it suspends.
This kind of launch is configured to open the Debug perspective when it suspends. 因为设置了断点才会弹出这个,不需要调 ...