Check out my very simplified Echo example : It is designed to use basic HTTP communication, but it can be easily changed to use named pipes by editing the app.config files for the client and server. Make the following changes:
Edit the app.config file by deleting or commenting out the http baseAddress entry and adding a new baseAddress for the named pipe (called net.pipe ). In addition, if you are not going to use HTTP for the communication protocol, make sure that serviceMetadata strong> and serviceDebug are either commented out or deleted:
<configuration> <system.serviceModel> <services> <service name="com.aschneider.examples.wcf.services.EchoService"> <host> <baseAddresses> <add baseAddress="net.pipe://localhost/EchoService"/> </baseAddresses> </host> </service> </services> <behaviors> <serviceBehaviors></serviceBehaviors> </behaviors> </system.serviceModel> </configuration>
Edit the app.config file so that basicHttpBinding is either commented out or deleted, and netNamedPipeBinding . You will also need to modify the endpoint entry to use the channel:
<configuration> <system.serviceModel> <bindings> <netNamedPipeBinding> <binding name="NetNamedPipeBinding_IEchoService"/> </netNamedPipeBinding> </bindings> <client> <endpoint address = "net.pipe://localhost/EchoService" binding = "netNamedPipeBinding" bindingConfiguration = "NetNamedPipeBinding_IEchoService" contract = "EchoServiceReference.IEchoService" name = "NetNamedPipeBinding_IEchoService"/> </client> </system.serviceModel> </configuration>
The above example will only work with named pipes, but nothing prevents you from using multiple protocols to start your service. AFAIK, you should be able to run the service on the server using both named pipes and HTTP (as well as other protocols).
In addition, the binding in the client's app.config file is very simplified. There are many different options that you can configure, in addition to specifying baseAddress ...
Alan S Jan 09 2018-12-12T00: 00Z
source share