我有个程序, 先注册了一个IpcChannel serverChannel = new IpcChannel("localhost"); 如下场景:
一个程序,起了一个实例后,我会再起个实例,对原先那个实例KILL掉, 再运行新起的实例。
那样的话,我再次运行IpcChannel serverChannel = new IpcChannel("localhost"); 先报“创建 IPC 端口失败: 拒绝访问。”
我试过: IChannel[] channels = ChannelServices.RegisteredChannels;
foreach (IChannel channel in channels)
{
IpcChannel ipc = channel as IpcChannel;
if (ipc == null)
{
continue;
}
ipc.StopListening(null);
ChannelServices.UnregisterChannel(ipc);
ipc = null;
}
也未能有用, 请教下是我要如何解决。
一个程序,起了一个实例后,我会再起个实例,对原先那个实例KILL掉, 再运行新起的实例。
那样的话,我再次运行IpcChannel serverChannel = new IpcChannel("localhost"); 先报“创建 IPC 端口失败: 拒绝访问。”
我试过: IChannel[] channels = ChannelServices.RegisteredChannels;
foreach (IChannel channel in channels)
{
IpcChannel ipc = channel as IpcChannel;
if (ipc == null)
{
continue;
}
ipc.StopListening(null);
ChannelServices.UnregisterChannel(ipc);
ipc = null;
}
也未能有用, 请教下是我要如何解决。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货