Vincent的备忘录

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