跨域或者Internet访问Remoting[Remoting FAQ]

简介:

[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: 登录没有成功

[分析]

在《RemotingFX2.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 theuseDefaultCredentials configuration property to false and setting the domainusername, and password configuration properties to specify an alternative identity.

默认情况下,一个TCP客户通道以当前运行的客户进程之下的用户标识来验证。也可以通过把useDefaultCredentials 配置属性设为false 并且设置domainusername, and passwordconfiguration 配置属性来设置特定的自定义标识。

 

[解决]

有人说,可以在服务端在注册Channel时,这么做:

将原来的ChannelServices.RegisterChannel(chan1, true);

改为

ChannelServices.RegisterChannel(chan1, false);

如果是这样声明的:

RemotingConfiguration.Configure(filename, true);

改为

RemotingConfiguration.Configure(filename, false);

这样来允许另外一个域的机器访问。

       但是似乎没有作用。

 

       下面这种做法,就不需要服务器端作改动。客户端调用时,需要知道服务器端的一个普通用户帐号密码,来配置自己的remoting

先看

客户端的Remoting配置信息

<system.runtime.remoting>

    <application>

      <client>

 

        <wellknown type="XXXX,YYYY"

                   url="tcp://RemotingServer:Port/Demo"/>

 

      </client>

      <channels>

        <channel ref="tcp" secure="true"   

                    impersonationLevel="Impersonation" protectionLevel="EncryptAndSign"         

                    username="RemotingServer-UserName" password="PASSWORD"         

                    domain="RemotingServer-DomainName">

          <clientProviders>

            <formatter ref="binary"/>

          </clientProviders>

          <serverProviders>

            <formatter ref="soap" typeFilterLevel="Full" />

            <formatter ref="binary" typeFilterLevel="Full" />

          </serverProviders>

        </channel>

      </channels>

    </application>

  </system.runtime.remoting>

       用这样的配置就可以成功模拟服务器端的用户调用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)
目录
相关文章
|
10天前
|
弹性计算 关系型数据库 微服务
基于 Docker 与 Kubernetes(K3s)的微服务:阿里云生产环境扩容实践
在微服务架构中,如何实现“稳定扩容”与“成本可控”是企业面临的核心挑战。本文结合 Python FastAPI 微服务实战,详解如何基于阿里云基础设施,利用 Docker 封装服务、K3s 实现容器编排,构建生产级微服务架构。内容涵盖容器构建、集群部署、自动扩缩容、可观测性等关键环节,适配阿里云资源特性与服务生态,助力企业打造低成本、高可靠、易扩展的微服务解决方案。
1214 5
|
9天前
|
机器学习/深度学习 人工智能 前端开发
通义DeepResearch全面开源!同步分享可落地的高阶Agent构建方法论
通义研究团队开源发布通义 DeepResearch —— 首个在性能上可与 OpenAI DeepResearch 相媲美、并在多项权威基准测试中取得领先表现的全开源 Web Agent。
1179 87
|
10天前
|
云栖大会
阿里云云栖大会2025年9月24日开启,免费申请大会门票,速度领取~
2025云栖大会将于9月24-26日举行,官网免费预约畅享票,审核后短信通知,持证件入场
1773 12
|
19天前
|
人工智能 运维 安全
|
2天前
|
资源调度
除了nrm-pm,还有哪些工具可以管理多个包管理器的源?
除了nrm-pm,还有哪些工具可以管理多个包管理器的源?
230 127
|
10天前
|
弹性计算 Kubernetes jenkins
如何在 ECS/EKS 集群中有效使用 Jenkins
本文探讨了如何将 Jenkins 与 AWS ECS 和 EKS 集群集成,以构建高效、灵活且具备自动扩缩容能力的 CI/CD 流水线,提升软件交付效率并优化资源成本。
362 0

热门文章

最新文章