IPC Port 'Access is denied'
来源:互联网 发布:真探 知乎 编辑:程序博客网 时间:2024/04/29 15:51
HashTable table; // properties //... table.Add("authorizedGroup", "Everyone"); table.Add("portName", name); // etc IpcChannel channel = new IpcChannel(table, clientSink, serverSink);
The solution was to add this to the IPC channel configuration:
<channel ref="ipc" portName="xxxManager" authorizedGroup="NtGroup" /> Then to add the AspNet user to the NT authorised group. Thanks for Sahil Malik!http://codebetter.com/blogs/sahil.malik/archive/2005/07/20/129505.aspx
using IpcChannel to replace IpcServerChannel.
//ClientBinaryClientFormatterSinkProvider 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 clientprop["authorizedGroup"] = "Everyone"IpcChannel channel = new IpcChannel(prop, clientProv, serverProv);ChannelServices.RegisterChannel(channel, false);
//ServerBinaryClientFormatterSinkProvider 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 clientprop["authorizedGroup"] = "Everyone"IpcChannel channel = new IpcChannel(prop, clientProv, serverProv);ChannelServices.RegisterChannel(channel, false);
Dictionary<string, string> props = new Dictionary<string, string>();props.Add("authorizedGroup", "Everyone");props.Add("portName", "ServerPortName");serverChannel = new IpcServerChannel(props, null);ChannelServices.RegisterChannel(serverChannel, true);RemotingConfiguration.RegisterWellKnownService
Type(typeof(MarshalByRefObjectSubCla ss), "ServerAppName", WellKnownObjectMode.SingleCall);serverChannel.StartListening(null); With the client setup like this in the web service:
using System;using System.Data;using System.Configuration;using System.Threading;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;using System.Runtime.Remoting;using System.Runtime.Remoting.Channels;using System.Runtime.Remoting.Channels.Ipc;using MyRemotingInterfaces;
public class RemotingClientFactory{
private static Mutex mut = new Mutex(); private static WellKnownClientTypeEntry remoteEntry; private static IpcClientChannel remoteChannel; private static string remoteUrl = "ipc://RemoteExampleRemoteServe r/RemoteExampleRemote";
static RemotingClientFactory() { }
(IRemoteExampleRemote)Activator.GetObject(remoteEntry.ObjectType, remoteUrl); public static IMyRemoteObject CreateRemote() { if (remoteChannel == null || remoteEntry == null) { mut.WaitOne(); try { if (remoteChannel == null) { remoteChannel = new IpcClientChannel(); ChannelServices.RegisterChannel(remoteChannel, true); } if (remoteEntry == null) { remoteEntry = new WellKnownClientTypeEntry (typeof(MyRemotingInterfaces.IMyRemoteObject), remoteUrl); RemotingConfiguration.RegisterWellKnownClientT ype(remoteEntry); } } finally { mut.ReleaseMutex(); } } try { IMyRemoteObject obj = return obj; } catch(Exception e) { //TODO log then rethrow throw e; } }}
And it works like a charm. It's not perfect, I'm sure. But it's a start. And it didn't seem like anyone had or wanted to post their solution to the newsgroups or anywhere else I could find.
- IPC Port 'Access is denied'
- Access is denied: 'AjaxPro'
- Access is denied
- Error---Access is denied
- 550 Access is denied.
- Cannot copy Access is Denied
- FTP 550 Access is denied.
- mongodbexport出现Access is denied
- ASP.NET错误: Access is denied
- Parser Error Message: Access is denied
- ASP.NET ERROR: Access is denied
- Access to the path is denied. ------- .net
- Access to the registry key is denied
- Access is denied + Unable to start debugging
- Access to the path is denied
- SharePoint 2010 - System.UnauthorizedAccessException: Access is denied
- Access to the path is denied
- general error c101008d:...Access is denied 问题解决
- hdu-1276
- 关于 android 中 edittext 特殊字符过滤和字符长度限制的最优方法
- ShellExecute, WinExec, CreateProcess区别
- oracle性能如何调整,如何回收表空间碎片
- 最小风险贝叶斯决策在广告微博过滤的实现算法
- IPC Port 'Access is denied'
- 动态规划intermediate:UVa 10604
- 1904_Beavergnaw
- 正则表达式30分钟入门教程
- 《jbpm5简单小案例》--环境搭建好,建立新项目只需替换bpmn文件即可
- soap12
- NYIST 15 The Triangle(空间优化)
- 新手上路手动档驾驶教程!
- 反射