从 WCF 中的 getDataAsync 的点网创建函数中获取错误

Getting an error from a dot-net created function of getDataAsync in WCF

我有:

[OperationContract]
string GetData(string input);

我收到一条错误消息 cannot have two operations in the same contract with the same name, methods GetDataAsync and GetData in type....violate this rule

但是我没有配置任何GetDataAsync功能!那么为什么会自动创建异步函数呢?我该如何停止它(因为我不需要它)?

当你有同名的方法 [OperationContract] 时会发生这种情况,无论这些方法是否接收不同的参数,你都不能用同名的方法命名。

并且当您添加服务引用时会自动创建 Ansy 方法,但您可以在服务引用中取消选中此选项。