WCF Proxy Authentication Required

The Problem

When I’m in the office, I have to use an authenticated proxy to get outside our intranet and to the internet. When I called a service that resides on the web, I got the 407 error. How can we fix this without having to provide an account to our application?

The Solution

The answer is actually pretty simple. The answer has nothing to do with WCF, but everything to do with System.Net.

System.Net’s default web proxy does not have the UseDefaultCredentials flag switched on by default. It’s false. Creating a new WebProxy object with the flag set to true is problematical… it turns out to be quite hard to find out the address and port of the default web proxy at runtime, because this is essentially a dynamic thing, and not (as previously thought in the .NET 1.x era) a static thing.

So by far the best thing to do is use your app’s App.Config file to tell System.Net to use the default credentials for authentication to an HTTP proxy server. Something like this:

<system.net>
    <defaultProxy useDefaultCredentials="true">
      <proxy autoDetect="True"/>
    </defaultProxy>
  </system.net>

转WCF Proxy Authentication Required的更多相关文章

  1. Tunnel connection failed: 407 Proxy Authentication Required

    报错信息 : Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connecti ...

  2. C# 调用 Web Service 时出现 : 407 Proxy Authentication Required错误的解决办法

    // 记得 using System.Net; System.Net.WebProxy myProxy = new System.Net.WebProxy("localhost:9099&q ...

  3. PowerShell (407) Proxy Authentication Required

    $Client = New-Object -TypeName System.Net.WebClient $Client.Proxy.Credentials = [System.Net.Credenti ...

  4. HttpWebRequest WebExcepton: The remote server returned an error: (407) Proxy Authentication Required.

    1. Supply the credentials of the Currently Logged on User to the Proxy object similar to this: // Be ...

  5. Redis服务停止报错解决方案[NOAUTH Authentication required]

    Redis服务器设置密码后,使用service redis stop 会出现以下信息: service redis stop Stopping ... OK (error) NOAUTH Authen ...

  6. jenkins 安装 SVN Publisher 后向 svn 提交代码报错: E170001: Authentication required for...

    问题描写叙述 安装并启动 jenkins 后,加入了 SVN Publisher 插件,然后在构建任务的"构建后操作"操作中加入了"Publish to Subversi ...

  7. Jedis异常解决:NOAUTH Authentication required

    引言 之前项目能够正常运行,因为默认选择db0,后来新的需求来了,不是默认db0,而是给参数选择db. 修改后代码如下,却报错NOAUTH Authentication required. 解决方法 ...

  8. redis 执行操作时提示(error) NOAUTH Authentication required.

    (error) NOAUTH Authentication required. 出现认证问题,设置了认证密码,输入密码即可 127.0.0.1:6379> auth 123456

  9. REdis MASTER aborted replication NOAUTH Authentication required

    对于REdis集群,如果设置了requirepass,则一定要设置masterauth,否则从节点无法正常工作,查看从节点日志可以看到哪下内容:19213:S 22 Apr 2019 10:52:17 ...

随机推荐

  1. 安卓微信浏览器中location.href失效的问题

    在移动web中,经常会使用window.location.href去跳转页面,这个方法在绝大多数浏览器中都不会存在问题,但是在安卓手机的微信自带浏览器中,会出现一个奇怪的bug. window.loc ...

  2. iconv 失败

    网上的都是这样用的 代码如下:              $content = iconv("utf-8","gb2312",$content); 这样做其实也 ...

  3. Apache 的ab测试

    <!-- 博主所有文章仅是作为自己的笔记 如有不足 请见谅--> Apache的ab测试  和  ab测试 不是一个东西(百度 ab测试可以了解) 网站性能压力测试是服务器网站性能调优过程 ...

  4. 今天第一次接触到typescript,看了第一个知识点就是变量的声明,来回忆回忆,做做笔记

    以前只用过JavaScript原生写网站特效,今天还是第一次听说typescript的,然后看了一下它的基本知识,感觉很像Java,真的太像了,但是又有不同点.很让我惊奇看到的第一个知识点就和以前不同 ...

  5. WebLogic 12c控制台上传获取webshell

    WebLogic 默认端口7001,一般可以通过这样来访问 http://10.9.1.1:7001/console 控制台 通过弱口令weblogic/weblogic登录控制台,下一步获取如何上传 ...

  6. PSP第九周

    一.表格 C(分类) C(内容) S(开始时间) ST(结束时间) I(打断时间) △(净工作时间) 学习 UML 12:30 13:20 0 50 编码 编码 20:00 22:10 0 130 学 ...

  7. kuangbin_SegTree D (POJ 2528)

    讲道理我之前暂时跳过染色的题是因为总觉得有什么很高端的算法来query 直到我做了F题(ZOJ 1610)才发现就是个暴力统计.....也对 也就几万个长度单位而已.... F就不po上来了 选了有点 ...

  8. Python之路,day4-Python基础

    1.集合2.元组 只读列表,只有count,index2个方法3.字典key-value对 1.特性 2.查询速度快,比列表快python中的hash在同一程序下值相同python字典中的hash只有 ...

  9. memcache/memcached安装教程并应用Tinkphp3.2

    在自己的新程序中打算全面应用memcached技术,这个很容易理解这是memcached是内存缓存,但是怎么还有memcache呢?其实很简单,memcache是php的一个扩展,用于php管理mem ...

  10. oracle 用户与表空间关系

    oracle用户与表空间关系用户=商家表=商品表空间=仓库1. 1个商家能有很多商品,1个商品只能属于一个商家2. 1个商品可以放到仓库A,也可以放到仓库B,但不能同时放入A和B3. 仓库不属于任何商 ...