跨域或者Internet访问Remoting[Remoting FAQ]
来源:互联网 发布:手机录音制作软件 编辑:程序博客网 时间:2024/04/30 19:35
[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参数时遇到的两种常见错误
- 网站的三种黏度是否具有实践基础?
- 机器如何计算“相关性”?
- 开发宝典:SEO-搜索引擎优化让你的网站更受欢迎
- Torquescript学习笔记:画物体的包围盒
- 也谈内容引擎,内容如何为王?
- 跨域或者Internet访问Remoting[Remoting FAQ]
- 做新闻记者的准则-著名战地记者阿内特的访谈
- 也说假如keso搞了个“对牛乱博网”
- oracle 11g下载 Oracle 10g下载 Oracle 9i下载
- 逐记录导出text/ntext字段值为文本文件
- 郑昀邀请开发(Java爬虫/C++自然语言)人才加盟[工作地点:北京]
- 团队初创两月小结
- 薄积薄发的国内BlogNetwork
- 话题讨论:中国SaaS概念能否一飞冲天?