【WCF】控制台程序实现WCF寄宿(http、net.tcp),相关配置文件
<?xml version="1.0" encoding="utf-8" ?> <configuration> <system.serviceModel> <bindings> <netTcpBinding> <binding name="LoginServiceBinding" transactionFlow="true"/> </netTcpBinding> </bindings> <services> <service name="Bruce.WCFService.Service1" behaviorConfiguration="Bruce.WCFService.Service1Behavior"> <host> <baseAddresses> <!--这里的IP配置地址可以随意,无验证--> <add baseAddress = "http://192.168.1.188:82" /> <!--这里的IP地址必须是本机IP或localhost或127.0.0.1,注意端口,若被占则无法启动,局域网其他客户端机器访问时候则指定为该服务器的真实IP--> <add baseAddress = "net.tcp://192.168.0.132:81" /> </baseAddresses> </host> <endpoint binding="basicHttpBinding" contract="Bruce.WCFService.IService1"> </endpoint> <endpoint binding="netTcpBinding" contract="Bruce.WCFService.IService1"></endpoint> <!--若以netTcpBinding,则必须加上以下代码--> <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/> </service> </services> <behaviors> <serviceBehaviors> <behavior name="Bruce.WCFService.Service1Behavior"> <serviceMetadata httpGetEnabled="True" /> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel> </configuration>
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。