wcf客户端和服务端配置
本帖最后由 wl58796351 于 2013-01-21 13:49:47 编辑 服务端配置:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<services>
<!--添加服务-->
<service name="WcfService.tbUser" behaviorConfiguration="CalculatorServiceBehavior">
<!--name 必须与代码中的host实例初始化的服务一样
behaviorConfiguration 行为配置 -->
<host>
<baseAddresses>
<!--添加调用服务地址-->
<add baseAddress="http://localhost:9090//tbUser.svc"/>
</baseAddresses>
</host>
<!--添加契约接口 contract="WcfDemo.IService1" WcfDemo.IService1为契约接口 binding="wsHttpBinding" wsHttpBinding为通过Http调用-->
<endpoint address="net.tcp://localhost:9000//tbUser.svc"
binding="netTcpBinding"
contract="WcfService.ItbUser"></endpoint>
</service>
<!--添加服务-->
<service name="WcfService.tbTmpdata" behaviorConfiguration="CalculatorServiceBehavior">
<!--name 必须与代码中的host实例初始化的服务一样
behaviorConfiguration 行为配置 -->
<host>
<baseAddresses>
<!--添加调用服务地址-->
<add baseAddress="http://localhost:9090//tbTmpdata.svc"/>
</baseAddresses>
</host>
<!--添加契约接口 contract="WcfDemo.IService1" WcfDemo.IService1为契约接口 binding="wsHttpBinding" wsHttpBinding为通过Http调用-->
<endpoint address="net.tcp://localhost:9000//tbTmpdata.svc"
binding="netTcpBinding"
contract="WcfService.ItbTmpdata"></endpoint>
</service>
</services>
<!--定义CalculatorServiceBehavior的行为-->
<behaviors>
<serviceBehaviors>
<behavior name="CalculatorServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<!--定义binding的行为-->
<bindings>
<wsHttpBinding>
<binding name="NewBindingStationCnfg" maxReceivedMessageSize="2147483647" />
</wsHttpBinding>
</bindings>
</system.serviceModel>
</configuration>
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding_IWCFService" />
</netTcpBinding>
</bindings>
<client>
<endpoint address="net.tcp://localhost:9000//tbUser.svc" binding="netTcpBinding"
bindingConfiguration="NetTcpBinding_IWCFService" contract="WcfService.ItbUser"
name="NetTcpBinding_IWCFService">
<identity>
<userPrincipalName value="Tianli2012\Administrator" />
</identity>
</endpoint>
<endpoint address="net.tcp://localhost:9000//tbTmpdata.svc" binding="netTcpBinding"
bindingConfiguration="NetTcpBinding_IWCFService" contract="WcfService.ItbTmpdata"
name="NetTcpBinding_IWCFService">
<identity>
<userPrincipalName value="Tianli2012\Administrator" />
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>