tags:

views:

248

answers:

2

Hello, 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

A: 

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?

JP Alioto
Thank you for the link, but I'm afraid this article is too big now because I need to solve my problem as soon as possible. Maybe you are right because as it turns out I have 2 projects with different domains and one of them works good, the second doesn't. Maybe you know some clue or signs to check what's happening?
Seacat
What channel are you using?
JP Alioto
A: 

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());

 }
}
Greg Dean
why? the object inherits MarshalByRefObject, it works perfectly in the same domain...
Seacat
Just because it inherits from MarshalByRefObject, doesn't make it a good design.
Greg Dean
Okay, anyway I need to transfer some object to server, how do you suppose to do that using "good design"?
Seacat
I updated my answer to demonstrate a typical remoting application.
Greg Dean
Okay, but the problem is how to return the result of this method to server. Could you do that?
Seacat
I assume you mean "from the server", updated with example
Greg Dean
In your sample the result remains on the client:ResultData result = proxy.DoSomething(new Data());Server know nothing about result.
Seacat
The server sends the results to the client. Thats how RPC works. proxy.DoSomething executes on the server.
Greg Dean