跨域或者Internet访问Remoting[Remoting FAQ]
来源:互联网 发布:1024是什么网站 知乎 编辑:程序博客网 时间:2024/04/30 23:52
[Remoting FAQ]
跨域或者Internet访问Remoting
Version
Date
Creator
Description
1.0.0.1
2006-6-1
郑昀@Ultrapower
草稿
继续阅读之前,我们假设您熟悉以下知识:
n Remoting
[需求]
虽然说,Remoting一般都在同一个域内调用,但有时候,也需要跨域访问,甚至于跨Internet访问。毕竟,让第三方远程测试下Remoting方法,不能要求人家加入你的域。
[现象]
在走TCP Channel访问Remoting情况下。
如果双方未作特殊处理,那么客户端会得到如下异常,提示对方Remoting服务不能信任你的身份:
异常信息
Unhandled Exception:
System.Security.Authentication.InvalidCredentialException:
The server has rejected the client credentials.
---> System.ComponentModel.Win32Exception: 登录没有成功
[分析]
在《Remoting在FX2.0中的新特性》提到了这么一段话:
By default, a TCP client channel authenticates itself with the user identity under which the client process is running. You can specify an alternative identity by setting the useDefaultCredentials configuration property to false and setting the domain, username, and password configuration properties to specify an alternative identity.
默认情况下,一个TCP客户通道以当前运行的客户进程之下的用户标识来验证。也可以通过把useDefaultCredentials 配置属性设为false 并且设置domain, username, and password configuration 配置属性来设置特定的自定义标识。
[解决]
有人说,可以在服务端在注册Channel时,这么做:
将原来的ChannelServices.RegisterChannel(chan1, true);
改为
ChannelServices.RegisterChannel(chan1, false);
如果是这样声明的:
RemotingConfiguration.Configure(filename, true);
改为
RemotingConfiguration.Configure(filename, false);
这样来允许另外一个域的机器访问。
但是似乎没有作用。
下面这种做法,就不需要服务器端作改动。客户端调用时,需要知道服务器端的一个普通用户帐号密码,来配置自己的remoting。
先看
客户端的Remoting配置信息
url="tcp://RemotingServer:Port/Demo"/>
impersonationLevel="Impersonation" protectionLevel="EncryptAndSign"
username="RemotingServer-UserName" password="PASSWORD"
domain="RemotingServer-DomainName">
用这样的配置就可以成功模拟服务器端的用户调用Remoting。
[更多信息]
对于上面的配置信息,我们需要说明几个特别的节点:
Client-Settings
- secure
true/false: enables/disables security - username, password, domain
if you don’t want to use the credentials of the client process, you can specify explicit ones here - impersonationLevel
Identification: The server can use the client token only for identity information and role based checks
Impersonation: The server can impersonate the client token to access server-local resources
Delegation: The server can delegate the client credentials - protectionLevel
None: clear text
Encrypt/Sign: self explanatory
EncryptAndSign: recommended setting - servicePrincipalName
SPN of the server. Required for Kerberos. Can use SPN (service/domain) or account syntax (domain/service)
- 跨域或者Internet访问Remoting[Remoting FAQ]
- 跨域或者Internet访问Remoting[Remoting FAQ]
- remoting
- Remoting
- Remoting
- remoting
- remoting
- Remoting
- Remoting
- Remoting
- Remoting
- Remoting
- Remoting
- Remoting在Internet环境下的测试
- Net Remoting(应用程序域)
- [Remoting] 一:.NET Remoting
- [Remoting] 一:.NET Remoting
- [Remoting FAQ]传递Remoting参数时遇到的两种常见错误
- 在不断地试错中调整向前
- 用SQL在文本文件中追加数据
- [J2ME Q&A]MMAPI"Cannot parse this type of AMR"异常之讨论
- 实例C#开发TCP/IP聊天室
- 期待CSDN2007技术英雄会之IBM大中华区总架构师寇卫东
- 跨域或者Internet访问Remoting[Remoting FAQ]
- 塑造敏捷企业:第二届“敏捷中国”技术大会将于北京召开
- [MSN谈话]专注、口碑和猎头
- 物有本末、事有终始-访CSDN总裁蒋涛
- [推介]明朝的那些事儿-历史应该可以写得好看
- 利用SQL移动硬盘文件
- zuma三阶段论和技术道路[一]
- 追寻圆通无碍的智慧
- 会展教育和培训,未来依然看好