问题描述:remoting的server是IIS作host,Client环境访问internet要通过firewall,所以报
The remote server returned an error: (407) Proxy Authenticaztion Required的错误.
原因:访问远程站点的时候,用了代理,没有设置用户名/密码.
解决:你可以显示的拒绝用代理,或者制定访问用代理的用户名和密码.
   如果你的程序需要设置代理,比如remoting host在internet外面。请设置一个代理
   */
   //System.Runtime.Remoting.Channels.ch
   HttpChannel theChannel = (HttpChannel)ChannelServices.GetChannel("http"); 
   setChannelProxy(theChannel,null);
   //setChannelProxy(theChannel,youproxy);
 
  /// <summary>
  /// 设置remoting 客户端proxy 的代码快
  /// 目前remoting 的httpclientchannel 并没有提供直接设置代理的方法,所以需要用反射来设置。</summary>
  /// <param name="channel"></param>
  /// <param name="proxy"></param>
  private static void setChannelProxy( HttpChannel channel, IWebProxy proxy )
  {
   //if configuration not set proxyserver then set channel's proxyName Properties to null
  
   if (proxy==null)
   {
    channel.Properties["proxyName"]=null;
    //saveProxyToReg(null,null,null,null,null);
    return;
   }
   //channel.Properties["proxyName"]=null;
   //use reflection to set the channel's proxyObject
   FieldInfo clientChannelFieldInfo =
    typeof(HttpChannel).GetField("_clientChannel",  
    BindingFlags.Instance | BindingFlags.NonPublic);
 
   HttpClientChannel clientChannel = (HttpClientChannel)
    clientChannelFieldInfo.GetValue(channel);
 
   FieldInfo proxyObjectFieldInfo =
    typeof(HttpClientChannel).GetField("_proxyObject",
    BindingFlags.Instance | BindingFlags.NonPublic);
 
   proxyObjectFieldInfo.SetValue( clientChannel, proxy );
 
   // use GlobalProxySelection to set other web request
   GlobalProxySelection.Select = proxy;
  }

remoting的Client如果访问IIS宿主server端要通过Firewall怎么办?相关推荐

  1. 没写client,想先测试server端怎么办?

    没写client,想先测试server端怎么办? 办法: 1.先打开终端./server,运行起来server 2.再开一个终端, 输入nc 127.0.0.1 8888 回车(这里port号要和se ...

  2. [AX]AX2012 C#使用IIS宿主AIF服务的一些问题

    AIF的服务可以是宿主在AOS,使用NetTcp适配器:也可以是宿主在IIS,使用HTTP适配器,两种方式都可以在C#工程中添加Service reference来调用这些服务.配置及使用NetTcp ...

  3. sofa server端处理client端请求流程

    背景:以sofa-rpc-master:5.6.0-SNAPSHOT版本为例,下载 代码,以 com.alipay.sofa.rpc.quickstart.QuickStartClient 和 com ...

  4. iis错误Server Application Error的解决方法(附修复工具下载)

    跟我一起住的一哥们,现在因为工作的需要,开始接触网络了,结果在很不容易的查询请教中,安装完IIS后,出现了让人心酸的问题:     Server application Error The Serve ...

  5. IIS出现server application error,请问怎么解决?

    Server Application Error The server has encountered an error while loading an application during the ...

  6. 在linux上配置unixODBC和FreeTDS访问MS SQL Server.

    一, 安装 unixODBC 下载安装包. 在 RedHat 安装光盘上就有 unixODBC-2.2.11-1.RHEL4.1.i386.rpm unixODBC-devel-2.2.11-1.RH ...

  7. BluetoothLE-Multi-Library 一个能够连接多台蓝牙设备的库,它可以作为client端,也可以为server端。支持主机/从机,外围设备连接。...

    github地址:https://github.com/qindachang/BluetoothLE-Multi-Library BluetoothLE-Multi-Library 一个能够连接多台蓝 ...

  8. IIS出现server application error解决方案

    IIS出现server application error解决方案  Server Application Error The server has encountered an error whil ...

  9. WCF访问iis元数据库失败--解决方法

    今天运行wcf服务器时,出现访问iis元数据库失败,解决方案: 运行WCF需要3.5以上版本的,所以就是找C:\WINDOWS\Microsoft.NET\Framework下的4.0就行 以2.0举 ...

  10. 错误 - 无法访问IIS元数据库

    本文翻译自:Error - Unable to access the IIS metabase After installing Visual Studio 2012 and opening my s ...

最新文章

  1. 叫你一声“孙悟空”,敢答应么?
  2. Fedora 19配置KVM虚拟机的桥接网络
  3. 三星台积电大笑 LG弃自研CPU英特尔代工遭重创
  4. Wpf拖动按钮实现(二)
  5. Adprep 无法完成,原因是回叫功能失败
  6. 现在很多技术知识点缺乏来龙去脉的介绍
  7. WebRTC端点检测使用中遇到的部分问题汇总
  8. ubuntu 16.04 安装教程
  9. POJ 2745 显示器 解题报告
  10. 光端机的作用有哪些?
  11. PPC(Pocket PC)中显示二进制数组(byte[])类型的图片
  12. 学术科普 | 漫威电影中的智能大脑
  13. springboot 优雅关闭_Springboot 优雅停止服务的几种方法
  14. php 非数字和字母,如何通过非数字与字符的方式实现PHP WebShell详解
  15. 纯 css 实现 a 标签 loading 效果
  16. Mac/Linux/Win使用scrcpy投屏
  17. 百面机器学习—3.逻辑回归与决策树要点总结
  18. c语言文件io的fork,15. C语言的fork
  19. Java开发使用百度翻译api
  20. echarts入门教程(超级详细带案例)

热门文章

  1. 郝斌老师C语言视频观感
  2. 教大家如何选购直播声卡
  3. 中国工业企业数据库(2015年)
  4. Python3安装tkinter
  5. Java编程练习题1
  6. 基于微信小程序点餐系统的设计与实现(含word论文)
  7. xmind zen 用法
  8. 计算机硬件检测与数据恢复试题,计算机硬件检测维修与数据恢复赛项国赛赛题.doc...
  9. python实例代码爬虫_python 网络爬虫实例代码
  10. GBaseDataStudio管理工具