首页 > 代码库 > 【WCF】控制台程序实现WCF寄宿(http、net.tcp),相关配置文件

【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>

 

【WCF】控制台程序实现WCF寄宿(http、net.tcp),相关配置文件