简体   繁体   English

没有重载方法需要2个参数

[英]no overload method takes 2 arguments

Hi I have a WCF service and within it I have this method 嗨,我有WCF服务,并且在其中有此方法

void SendData(int pumpNo, List<String> pumpInfo);

however when I try to pass an int and a list into it, I get an error saying 但是,当我尝试将一个int和一个列表传递给它时,出现错误提示

Error 1 No overload for method 'SendData' takes 2 arguments 错误1方法'SendData'没有重载需要2个参数

This is how I passed data to it in the WCF client 这就是我在WCF客户端中向其传递数据的方式

sendpumpdata.SendData(pumpID, pumpData);

ok so at the top I create an instance of the WCF service by doing... 好的,所以在顶部,我通过执行以下操作来创建WCF服务的实例:

ServiceReference1.iCommClient sendpumpdata = new Pumps.ServiceReference1.iCommClient();

also in my service.cs I have created the method defined in the IService.cs 同样在我的service.cs中,我创建了IService.cs中定义的方法

A WCF web service leverages client generated code (ie a proxy) to communicate with the server. WCF Web服务利用客户端生成的代码(即代理)与服务器进行通信。 In your situation, even though the server code has two parameters, your client generated code must be out of date. 在您的情况下,即使服务器代码具有两个参数,您的客户端生成的代码也必须已过期。

If you're using a Web Reference or a Service Reference just right click and Update Reference. 如果您使用的是Web参考或服务参考,请右键单击并更新参考。 If you're using a static WSDL then navigate to the WSDL hosted locally for the WCF service and save it to disk and then overwrite the one in your project. 如果您使用的是静态WSDL,请导航到本地为WCF服务托管的WSDL,并将其保存到磁盘,然后覆盖项目中的WSDL。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM