.NET Remoting In Windows Service
-
Wednesday, November 29, 2006 5:26 PM
Hi,
My windows service application contains an IpcChannel which listens msg from
client.
If I install it with MyServiceProcessInstaller.Account="LocalSystem" or
"LocalService", or "NetworkService". Then I got an exception
"System.Runtime.Remoting.RemotingException: Failed to connect to an IPC
Port: Access is denied" when client IPC channel try to connect to service.However If I install my service with
MyServiceProcessInstaller.Account="User". Then everything is fine. in this
case both client and server running under the same username.My goal is to install the service as "LocalSystem" or "LocalService", client
can be any user and group. since I leave the "authroizedGroup" channel
property as default and there is no security setting for IPC channel, I am
thinking the problem is not in the IPC channel configuration, rather I need
to configure Windows service properly.Your advice is highly appreciated
All Replies
-
Monday, March 12, 2007 3:07 PMHi,
I had the exact same problem. It appears there are all kinds of problems with IPC (including the problem you have here and a complete inability to handle multiple clients to a single object when events are involved).
I can only suggest you fall back to TCP which is what I had to do (it was not a problem for me because our system tried IPC first, then TCP and finally HTTP/SOAP).
Sorry if this is not the answer you were hoping for, -
Friday, June 01, 2007 7:51 PM
Hi,
We ran into the same thing. We remote from a desktop application to a windows service. We found the solution is to add the remoting properties which are hard to find but effective. Example is below:
//Client
BinaryClientFormatterSinkProvider clientProvider = new BinaryClientFormatterSinkProvider();
BinaryServerFormatterSinkProvider serverProvider = new BinaryServerFormatterSinkProvider();
IDictionary prop = new Hashtable();
prop["portName"] = "Client";
//This seemed to be the key property to allow us to not get the access denied. We added this to both the server and the client
prop["authorizedGroup"] = "Everyone"
IpcChannel channel = new IpcChannel(prop, clientProv, serverProv);
ChannelServices.RegisterChannel(channel, false);//Server
BinaryClientFormatterSinkProvider clientProvider = new BinaryClientFormatterSinkProvider();
BinaryServerFormatterSinkProvider serverProvider = new BinaryServerFormatterSinkProvider();
IDictionary prop = new Hashtable();
prop["portName"] = "Server";
//This seemed to be the key property to allow us to not get the access denied. We added this to both the server and the client
prop["authorizedGroup"] = "Everyone"
IpcChannel channel = new IpcChannel(prop, clientProv, serverProv);
ChannelServices.RegisterChannel(channel, false); -
Wednesday, January 14, 2009 6:22 PMHi everyone,From the documentation:
authorizedGroup = A string that specifies the group or user that has permission to connect to this channel. The default is to allow access to all authorized users.
From other postings I found it seems like only the owner can access a port by default. Does that mean that 1) the only "authorized user" is the owner or 2) the documentation is incorrect or 3) the code is defective? Or is there an explanation that I did not imagine?
If I specify "Everyone" will that work across the different language versions of the OS? Or do I need to specify the language-specific word for "Everyone" in the other languages? Seems like a hack to me. I wish the code were implement as the documentation implies.
David


