[英]Getting an error from a dot-net created function of getDataAsync in WCF
I have: 我有:
[OperationContract]
string GetData(string input);
I get an error saying cannot have two operations in the same contract with the same name, methods GetDataAsync and GetData in type....violate this rule
我收到一条错误消息,说cannot have two operations in the same contract with the same name, methods GetDataAsync and GetData in type....violate this rule
But I didn't configure any GetDataAsync
function! 但是我没有配置任何GetDataAsync
函数! So why is the async function being automatically created? 那么为什么要自动创建异步功能呢? How do I stop it (because I don't need that)? 如何停止它(因为我不需要那个)?
This occurs when you have methods [OperationContract] with same name, no matter if those methods receives different parameters, you can't name methods with same name. 当您具有名称相同的方法[OperationContract]时,就会发生这种情况,无论这些方法是否接收不同的参数,都无法使用相同的名称命名方法。
and the Ansy method is created automatically when you add the service reference, but you can uncheck this option in the service reference. 并且在添加服务参考时将自动创建Ansy方法,但是您可以在服务参考中取消选中此选项。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.