Adding a service link to the net.pipe service

I started learning WCF and successfully created some test http services. Now I was trying to create a self-service WCF service using net.pipe binding. The following is the configuration file for the service: -

<?xml version="1.0" encoding="utf-8" ?> <configuration> <system.serviceModel> <services> <service behaviorConfiguration="MEX" name="InProcService.MyService"> <endpoint address="MyService" binding="netNamedPipeBinding" bindingConfiguration="" contract="InProcService.IMyService" /> <endpoint address="Mex" binding="mexNamedPipeBinding" contract="IMetadataExchange" /> <host> <baseAddresses> <add baseAddress="net.pipe://localhost/InProcService/" /> <add baseAddress="http://localhost:8001/InProcService/" /> </baseAddresses> </host> </service> </services> <behaviors> <serviceBehaviors> <behavior name="MEX" > <serviceMetadata httpGetEnabled="true"/> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel> </configuration> 

Now in my host application, I start the service using: -

  ServiceHost host = new ServiceHost(typeof(MyService)); host.Open(); Console.WriteLine("Service started"); host.Close(); 

The service starts correctly when this code is executed.

Now, when I try to add a service link to this running service in my client application, it cannot find it. Is there something I'm doing wrong or wrong?

I would appreciate any help I can get from this.

Cheers, Abi.

+4
source share
1 answer

After that, the service opens and closes. By the time the client starts, the server is already closed. So Console.ReadKey () is required before closing.

+2
source

Source: https://habr.com/ru/post/1334382/


All Articles