我正在尝试创建一个基本的WCF application
并使用Console Application
来调用该服务。我将service reference
添加到WCF Service
并在Console Application
内将其称为
ServiceName.Service s = new ServiceName.Service();
string str = string.empty;
str = s.GetData(10); // here i get an argument overload mismatch error
在Service.cs
WCF Service
文件中,此方法定义为
public string GetData(int value)
{
return string.Format("You entered: {0}", value);
}
为什么我在这种情况下得到参数重载不匹配错误?我是WCF的新手。我已将WCF服务添加为服务引用。
答案 0 :(得分:0)
原来,该服务未正确托管。我重新构建了解决方案,并在重新托管WCF service client
后才能正常工作。
参数对应于Service.cs