前一段写的一个东西,需要控制远程的计算机做一些操作。由于有端口的访问限制,所以我选择了在服务器使用Web Service + Remoting IpcChannel + Windows Service的方式。在实现过程中遇到了这样的问题:通过web method调用IpcChannel时,总是提示Access denied。
解决的方法就是在创建IpcChannel时指定authorizedGroup参数(无论是使用代码创建还是使用配置文件配置)
这里指定了所有属于Users用户组的用户都可以访问这个IpcChannel. 好了,问题解决!备案。。。
解决的方法就是在创建IpcChannel时指定authorizedGroup参数(无论是使用代码创建还是使用配置文件配置)
Hashtable ht
=
new
Hashtable();
ht[ " portName " ] = " RemoteEncoder:9090 " ;
ht[ " name " ] = " ipc " ;
ht[ " authorizedGroup " ] = " Users " ;
IpcChannel channel = new IpcChannel(ht, null , null );
ChannelServices.RegisterChannel(channel, false );
RemotingConfiguration.RegisterWellKnownServiceType( typeof (Server), " Server.rem " , WellKnownObjectMode.Singleton);
ht[ " portName " ] = " RemoteEncoder:9090 " ;
ht[ " name " ] = " ipc " ;
ht[ " authorizedGroup " ] = " Users " ;
IpcChannel channel = new IpcChannel(ht, null , null );
ChannelServices.RegisterChannel(channel, false );
RemotingConfiguration.RegisterWellKnownServiceType( typeof (Server), " Server.rem " , WellKnownObjectMode.Singleton);
这里指定了所有属于Users用户组的用户都可以访问这个IpcChannel. 好了,问题解决!备案。。。