【发布时间】:2023-03-20 08:30:01
【问题描述】:
我有两个应用程序在 NetNamedPipeBinding 上使用 WCF 协议进行通信。一个是在 SYSTEM 下运行的服务(“S”),另一个是应用程序(“A”)。 “A”创建一个 WCF 服务。
当“A”以管理员权限运行时,一切正常。但是当在受限用户下运行时,“A”可以创建“S”无法访问的 WCF 服务。 错误是:
System.ServiceModel.EndpointNotFoundException: There was no endpoint listening at net.pipe://app/results that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. ---> System.IO.PipeException: The pipe endpoint 'net.pipe://app/results' could not be found on your local machine.
这个想法是让每个用户(每个用户凭据)都可以访问这个 WCF 服务。 可以使用 NetNamedPipeBinding 完成吗?最好在代码中进行整个配置,而不是在配置文件中。
var binding = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None);
var baseAddress = new Uri(url);
var serviceHost = new ServiceHost(implementor);
serviceHost.AddServiceEndpoint(typeof(IImplementor), binding, baseAddress);
serviceHost.Open();
【问题讨论】:
-
我找到了切换到 HTTP 绑定并运行“netsh”的解决方案。但是很高兴知道如何在代码中实现类似的逻辑。
标签: windows wcf wcf-binding