我经历了以下引用,发现可以动态调用WCF服务。但是,我无法将接受参数的服务(方法)称为 ref 和 out 。
Calling a WCF service from a client without having the contract interface
Dynamically Invoking Web Services... With WCF This Time
Invoking WCF Service without adding a Service Reference.
有没有办法通过参考和输出参数进行此类调用?
答案 0 :(得分:2)
Invoking WCF Service without adding a Service Reference.就会有效。所以我首先添加了Web引用,将生成的代理复制到实际项目中,然后删除了Web引用并简单地将方法称为
BasicHttpBinding binding = new BasicHttpBinding();
EndpointAddress epAddr = new EndpointAddress("http://192.168.0.233/GMS/GMSService.svc");
GMSContract.IGMSService _interface = ChannelFactory<GMSContract.IGMSService>.CreateChannel(binding, epAddr);
...
bool r = _interface.MyGMSMethod(..., ref ..., out ..., out ...);