我正在寻找WCF命名管道的最小示例(我期望两个最小的应用程序,服务器和客户端,它们可以通过命名管道进行通信.)
Microsoft有一篇很好的文章" 入门教程",它通过HTTP描述了WCF,我正在寻找类似于WCF和命名管道的东西.
我在互联网上发现了几个帖子,但它们有点"先进".我需要一些最小的,只有强制性的功能,所以我可以添加我的代码并使应用程序正常工作.
如何替换它以使用命名管道?
<endpoint address="http://localhost:8000/ServiceModelSamples/Service/CalculatorService"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_ICalculator"
contract="ICalculator" name="WSHttpBinding_ICalculator">
<identity>
<userPrincipalName value="OlegPc\Oleg" />
</identity>
</endpoint>
Run Code Online (Sandbox Code Playgroud)
如何替换它以使用命名管道?
// Step 1 of the address configuration procedure: Create a URI to serve as the base address.
Uri baseAddress = new Uri("http://localhost:8000/ServiceModelSamples/Service");
// Step 2 of the hosting procedure: Create ServiceHost
ServiceHost selfHost = new ServiceHost(typeof(CalculatorService), baseAddress);
try
{
// Step 3 of the hosting procedure: Add a service endpoint.
selfHost.AddServiceEndpoint(
typeof(ICalculator),
new WSHttpBinding(),
"CalculatorService");
// Step 4 of the hosting …Run Code Online (Sandbox Code Playgroud)