<?xml version= "1.0" encoding= "Utf-8"?>
<configuration>
<startup>
<supportedruntime version= "v4.0" sku= ". netframework,version=v4.5 "/>
</startup>
<appSettings>
<add key= "Aspnet:usetaskfriendlysynchronizationcontext" value= "true"/>
</appSettings>
<system.web>
<compilation debug= "true"/>
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name= "Myservicebehavior" >
<servicemetadata httpgetenabled= "true" httpsgetenabled= "true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<wsDualHttpBinding>
<binding name= "dualhttpbinding" transactionflow= "true" maxreceivedmessagesize= "100000"
messageencoding= "Text" >
<security mode= "None" >
<message clientcredentialtype= "None" negotiateservicecredential= "false"/>
</security>
</binding>
</wsDualHttpBinding>
</bindings>
<services>
<service behaviorconfiguration= "Myservicebehavior" name= "service. MyPublisher ">
<endpoint address= "" binding= "wsdualhttpbinding" contract= "service. Imycontract "bindingconfiguration=" dualhttpbinding ">
<!--<identity>
<dns value= "localhost"/>
</identity>-->
</endpoint>
<!--<endpoint address= "Mex" binding= "mextcpbinding" contract= "IMetadataExchange"/>-->
<endpoint address= "Mex" binding= "mexHttpBinding" contract= "IMetadataExchange"/>
<baseAddresses>
<add baseaddress= "http://192.168.0.139:8899/"/>
</baseAddresses>
</service>
</services>
</system.serviceModel>
</configuration>
The above is the wsdualhttpbinding configuration file, wsdualhttpbinding is used to implement two-way communication. After the red part is added, the server and client software can be deployed on different machines (the blue part is removed).
If you do not have the following red section:
<security mode= "None" >
<message clientcredentialtype= "None" negotiateservicecredential= "false"/>
</security>
The client will receive the following exception error:
The caller was wasn't authenticated by the service.
Another thing to be aware of when deploying on different machines is: Turn off the firewall.
Wcfdualhttpbinding configuration of servers and clients deployed on different machine issues