Cannot have two operations in the same contract with the same name (Async & Non)

后端 未结 5 1726
被撕碎了的回忆
被撕碎了的回忆 2021-01-01 15:15

I get the following exception (Cannot have two operations in the same contract with the same name, methods ExecuteAsync and Execute) when the following service is activated.

5条回答
  •  南笙
    南笙 (楼主)
    2021-01-01 16:14

    The above is not valid because WCF itself makes two methods for each OperationContract in your case Execute() one synchronous and second asynchronous, which can be called on client side by writing ServiceClientObj.ExexuteAsync(request), so you don't need to add async method explicitly in the IMyService.The Framework is itself responsible for generating async method of each Operation

提交回复
热议问题