Abhijit Mane

Hello,
I have strange situation on hand , I have remotely exposed an object through Windows serice. I am using Client Activated Objects(CAO) . Now whenever I try to create an proxy object on the client, I get an Target Innvocation exception, this is when the service is running . Everything works great when I stop the service and start the .exe for the service. I initially thought this can be authentication issue.
I tried running the service under Administrator login but of no use.

Can someone please help,it's Urgent.

Here is the code:

BinaryServerFormatterSinkProvider serverProv = new BinaryServerFormatterSinkProvider();
serverProv.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
BinaryClientFormatterSinkProvider clientProv = new BinaryClientFormatterSinkProvider();
System.Collections.IDictionary props = new System.Collections.Hashtable();
props["port"] = 0;
TcpChannel chan = new TcpChannel(props, clientProv, serverProv);
ChannelServices.RegisterChannel(chan);

RemotingConfiguration.RegisterActivatedClientType(typeof(FigMDClient.Classes.RemoteDataAccess), "tcp://Dev009:8080/RemoteDataAccess");
objRemoteDataAccess = new FigMDClient.Classes.RemoteDataAccess();// Exception thrown here.




Re: .NET Remoting and Runtime Serialization Exposing an Object using Remoting through Windows Service

Ryszard Kwiecinski - MSFT

Can you send the exception that you're getting

-Ryszard





Re: .NET Remoting and Runtime Serialization Exposing an Object using Remoting through Windows Service

Micky D

Sounds like it's because the server is running in a different account than the client app - since you are using Client Activation.

That may be why it runs OK when you 'just run the exe' - the server is now running in the interactive account i.e. you. This is the same account as your client app.

Either make the service run in your account as a test (I wouldn't recommend this for production) or make your client Server-activated.