wcf 使用介绍
陶永波 20:22:28 CrerialAPI 客户端 <system.ServiceModel> <client>
<endpoint adddress="http://127.0.0.1/wcfService.svc" contract="Namespace.IContract" bind="basicHttpBinding" name="test">
IChannelFactory factory=new ChannelFactory("test") using(IContract proxy=factory.CreateChannel()) { proxy.Invoke("aaa"); }
服务端
IContract
[ServiceContract] interface IContract { [OperationContract] void Invoke(string sss); }
Service:IContract { Invoke(string sss) { } }
<system.ServiceModel> <service name="Namespace.Service">
<endpoint adddress="http://127.0.0.1/wcfService.svc" contract="Namespace.IContract" bind="basicHttpBinding" >
在web中发布是新建一个wcf文件修改文件为<%@ ServiceHost Language="C#" Debug="true" Service="VrvService.XmlTraversalService" %> 及调用命名空间里的类