使用不同域时的远程处理问题

发布于 2024-07-17 02:09:35 字数 488 浏览 2 评论 0原文

我有以下项目: 服务器、客户端、远程对象。 客户端做一些事情,然后将远程对象的代理传递给服务器。 在服务器和客户端位于不同的域之前,所有事情都可以正常工作。 现在,当我尝试将结果传递到服务器时出现异常

“mscorlib.dll 中发生了类型为‘System.Runtime.Remoting.RemotingException’的未处理异常

附加信息:此远程处理代理没有通道接收器,这意味着服务器没有正在侦听的已注册服务器通道,或者此应用程序没有合适的通道”与服务器对话的客户端通道。”

互联网上的一些消息来源说我需要创建一些额外的通道,但我不知道应该在哪里以及如何执行此操作,因为我已经在服务器和客户端上注册了通道。

Info:
server - domain 2
client - domain 1
remote object - domain 1

谢谢

I have the following project:
server, client, remote object. client does something, then pass the proxy of remote object to the server. All the things work property until server and client are in different domains. Now, when I try to pass result to server I have an exception

"An unhandled exception of type 'System.Runtime.Remoting.RemotingException' occurred in mscorlib.dll

Additional information: This remoting proxy has no channel sink which means either the server has no registered server channels that are listening, or this application has no suitable client channel to talk to the server. "

some sources on Internet says that I need to create some additional channel but I don't know where and how should I do that because I have the channel registration on server and client yet.

Info:
server - domain 2
client - domain 1
remote object - domain 1

Thank you

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

心奴独伤 2024-07-24 02:09:35

对我来说听起来像是权限问题。 您如何托管远程对象? 您如何跨域进行身份验证? 这是一篇不错的文章,介绍了您在身份验证方面可能遇到的一些问题。

来自本文 ...

默认情况下,TCP 客户端通道使用客户端进程运行时所用的用户身份对自身进行身份验证。 您可以通过设置域、用户名和密码属性来指定备用身份来指定备用身份

您是否在通道属性上指定了正确的凭据(包括域)?

Sounds like a permissions issue to me. How are you hosting your remoting objects? How are you authenticating across domains? Here's a decent article on some of the issues you might face with auth.

From this article ...

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 domain, username, and password properties to specify an alternative identity

Have you specified correct credentials (including domain) on your channel properties?

鱼窥荷 2024-07-24 02:09:35

然后传递远程对象的代理
到服务器

你能解释一下吗? 这听起来不是一个好主意。 通常,代理用于调用远程方法 (RPC)。 将代理传递回服务器是没有意义的。 当然,它在某些情况下可能有效,但它只会增加不必要的复杂性。

如果要传递对象,请创建一个单独的数据类并将其作为参数传递给远程方法。

Common.dll

[Serializable]
public class Data
{
    int a;
    int b;
}
[Serializable]
public class ResultData
{
    int c;
}
public interface IServerInterface
{
    ResultData DoSomething(Data data);
}

服务器.dll

public class ServerObject : MarshalByRefObject, IServerInterface
{
    public ResultData DoSomething(Data data)
    {
        // do some work on the server
        return new ResultData();
    }
}

客户端.exe

class Program
{
    static void Main(string[] args)
    {
        IServerInterface proxy = CreateProxy();
        ResultData result = proxy.DoSomething(new Data());

    }
}

then pass the proxy of remote object
to the server

Can you explain this? This doesn't sound like a good idea. Typically a proxy is used to invoke remote methods (RPC). Passing the proxy back to the server, doesn't make sense. Sure it may work in some scenarios, but it just adds unnecessary complication.

If you want to pass an object, create a separate data class and pass that as a parameter to the remote method.

Common.dll

[Serializable]
public class Data
{
    int a;
    int b;
}
[Serializable]
public class ResultData
{
    int c;
}
public interface IServerInterface
{
    ResultData DoSomething(Data data);
}

Server.dll

public class ServerObject : MarshalByRefObject, IServerInterface
{
    public ResultData DoSomething(Data data)
    {
        // do some work on the server
        return new ResultData();
    }
}

Client.exe

class Program
{
    static void Main(string[] args)
    {
        IServerInterface proxy = CreateProxy();
        ResultData result = proxy.DoSomething(new Data());

    }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文