您的位置:首页 > 其它

在WEB程序中使用.NET Remoting的IpcChannel时注意事项(关于“拒绝访问”问题的解决)

2006-06-20 14:44 1001 查看
前一段写的一个东西,需要控制远程的计算机做一些操作。由于有端口的访问限制,所以我选择了在服务器使用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, null, null);
ChannelServices.RegisterChannel(channel, false);
RemotingConfiguration.RegisterWellKnownServiceType(typeof(Server), "Server.rem", WellKnownObjectMode.Singleton);

这里指定了所有属于Users用户组的用户都可以访问这个IpcChannel. 好了,问题解决!备案。。。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐