remoting的Client如果访问IIS宿主server端要通过Firewall怎么办?
来源:互联网 发布:淘宝上下架软件 编辑:程序博客网 时间:2024/04/24 05:18
问题描述: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);
*/
//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 客户端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怎么办?
- Silverlight通过httpBinding访问IIS宿主WCF
- Remoting with IIS Server and ASP.NET Client
- 通过Remoting分布公网上的Server实现对Client的回调
- 在Remoting Server上取得Remoting Client的IP地址
- remoting教学五:将remoting宿主到IIS
- 使用宿主 self host server 创建 api 服务( 如果你没有IIS ,还想用rest风格api)
- 安装了ORALCE client 通过IIS发布的网站却不能访问ORACLE。
- 宿主程序为windows服务的remoting
- 如果windows 没有IIS组件 怎么办?
- 如果windows 没有IIS组件 怎么办?
- Remoting from IIS Hosted component to ASP.NET Client application
- IIS 访问 SQL Server
- IIS 7中.NET Remoting访问出现404错误的解决方法
- .Net Remoting的双向通信和Windows Service的宿主服务
- .Net Remoting的双向通信和Windows Service的宿主服务
- .Net Remoting的双向通信和Windows Service的宿主服务
- 安桌Client如何访问server的service,以及service如何访问client的函数
- 装机广告
- 通过encryption.exe对java的class文件进行加密
- 36招搞定电脑一切难题
- 听着熟悉的《东风破》,好想你~
- 过年了,异乡漂泊的我也可以回家了^^
- remoting的Client如果访问IIS宿主server端要通过Firewall怎么办?
- 我的自述
- 《大腕》IT版
- 程序员
- VC++编译环境详解(转载)
- 天使在等我……
- 读取oracle表结构和字段的注释
- 买酱油与软件工程阶段划分
- 【转贴】笑死你的整人电话终极篇!