使具有NetNamedPipeBinding的WCF主机可以从Windows 10上的每个人访问



我有两个应用程序在NetNamedPipeBinding上与WCF协议通信。一个是在SYSTEM下运行的服务("S"(,另一个是应用程序("a"(。";A";创建WCF服务。

当";A";以管理员权限运行,一切正常。但是当在有限用户下运行时;A";可以创建WCF服务;S〃;无法到达。错误为:

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服务可以从每个用户(Everyone凭据(访问。可以用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();

如果代码相同,但访问用户不同,则意味着非管理员用户无法访问该服务。

也许你可以试试下面的样品。它仍然不起作用,你可以将错误文件提交给官方。

https://learn.microsoft.com/en-us/dotnet/api/system.servicemodel.netnamedpipebinding?view=netframework-4.8

谢谢。

最新更新